-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(browser): Add new v7 Fetch Transport #4765
Conversation
packages/core/src/request.ts
Outdated
// 2. Restore the original version of the request body, which is commented out | ||
// 3. Search for either of the PR URLs above and pull out the companion hacks in the browser playwright tests and the | ||
// baseClient tests in this package | ||
enhanceEventWithSdkInfo(event, api.metadata.sdk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not nice to duplicate all of this, but considering we are deleting stuff very soon, I think duplicating this code is fine.
size-limit report 📦
|
ouch size-limit bot |
Opened #4778 with some changes from this PR |
So it seems this is failing on the minified bundles 🤔 |
So in regular bundles it works fine (
@onurtemizkan any idea why this might be happening? |
@AbhiPrasad, that's very strange, there aren't any special cases for minified bundles, while building pages. |
Figured it out, it's because the minified bundle minifies the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the _experiments
problem (and the linter check), these changes look good to me. Also made a lot of sense when going over them while implementing #4803.
* add the new XHR Transport creation functionality. The function makeNewXHRTransport(...) creates a Transport that is based on the browser's XMLHttpRequest API. It is used as a fallback if the Fetch API is not available (IE11...). The creation function is similar to the new Fetch Transport creation introduced in #4765. * in addition to the transport creation function, this PR also adds tests which verify the correct calls to the XMLHttpRequest API. Furthermore, the tests check for correct request/response header setting.
* add the new XHR Transport creation functionality. The function makeNewXHRTransport(...) creates a Transport that is based on the browser's XMLHttpRequest API. It is used as a fallback if the Fetch API is not available (IE11...). The creation function is similar to the new Fetch Transport creation introduced in #4765. * in addition to the transport creation function, this PR also adds tests which verify the correct calls to the XMLHttpRequest API. Furthermore, the tests check for correct request/response header setting.
This PR creates the new v7 Fetch Transport, and updates the browser backend to use the new transport. To configure the transport, users can supply `requestOptions`, which is supplied to the fetch request. This consolidates the earlier pattern of passing in both headers and fetchParameters that the old fetch transport used to use.
* add the new XHR Transport creation functionality. The function makeNewXHRTransport(...) creates a Transport that is based on the browser's XMLHttpRequest API. It is used as a fallback if the Fetch API is not available (IE11...). The creation function is similar to the new Fetch Transport creation introduced in #4765. * in addition to the transport creation function, this PR also adds tests which verify the correct calls to the XMLHttpRequest API. Furthermore, the tests check for correct request/response header setting.
add integration tests to test the new XHR transport introduced in #4803 * the tests are very similar to the new Fetch transport integration tests introduced in #4765. The only difference is that they disable the browsers' Fetch API by setting window.fetch = undefined. This way, the SDK falls back to the XHR transport.
This PR creates the new v7 Fetch Transport, and updates the browser backend to use the new transport. To configure the transport, users can supply
requestOptions
, which is supplied to the fetch request. This consolidates the earlier pattern of passing in both headers and fetchParameters that the old fetch transport used to use.Part of #4660
Resolves https://getsentry.atlassian.net/browse/WEB-726