Skip to content

Commit

Permalink
add newXhr creation in BrowserBackend
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Mar 28, 2022
1 parent 105abad commit db1dcd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/browser/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Event, EventHint, Options, Severity, Transport, TransportOptions } from
import { supportsFetch } from '@sentry/utils';

import { eventFromException, eventFromMessage } from './eventbuilder';
import { FetchTransport, makeNewFetchTransport, XHRTransport } from './transports';
import { FetchTransport, makeNewFetchTransport, makeNewXHRTransport, XHRTransport } from './transports';

/**
* Configuration options for the Sentry Browser SDK.
Expand Down Expand Up @@ -77,6 +77,11 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
this._newTransport = makeNewFetchTransport({ requestOptions, url });
return new FetchTransport(transportOptions);
}

this._newTransport = makeNewXHRTransport({
url,
headers: transportOptions.headers,
});
return new XHRTransport(transportOptions);
}
}
2 changes: 1 addition & 1 deletion packages/browser/src/transports/new-xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SyncPromise } from '@sentry/utils';
const XHR_READYSTATE_DONE = 4;

export interface XHRTransportOptions extends BaseTransportOptions {
headers?: Record<string, string>;
headers?: { [key: string]: string };
}

/**
Expand Down

0 comments on commit db1dcd4

Please sign in to comment.