-
-
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 XHR Transport #4803
Conversation
size-limit report 📦
|
db1dcd4
to
57a06f4
Compare
CI should pass once #4810 is done and merged (the errors seem to be related to MongoDB) |
const XHR_READYSTATE_DONE = 4; | ||
|
||
export interface XHRTransportOptions extends BaseTransportOptions { | ||
headers?: { [key: string]: string }; |
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.
Decided to go with {[key: string]: string}
instead of Record
as it is used that way in TransportOptions
sentry-javascript/packages/types/src/transport.ts
Lines 52 to 56 in caba96e
export interface TransportOptions { | |
/** Sentry DSN */ | |
dsn: DsnLike; | |
/** Define custom headers */ | |
headers?: { [key: string]: string }; |
which are passed to makeNewXHRTransport
. Seems to be more consistent that way IMHO
add makeNewXHRTransport function (WIP, needs testing(
1224b1d
to
4672d15
Compare
* 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.
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 adds the new XHR Transport creation functionality. The function
makeNewXHRTransport(...)
creates a Transport that is based on the browser'sXMLHttpRequest
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. Note that I didn't include integration tests for this change as I did not yet find a way to "deactivate" the Fetch API in our playwright test framework. If I figured out a way to do this, Integration tests will follow in a separate PR.ref: https://getsentry.atlassian.net/browse/WEB-727