Skip to content

Commit

Permalink
Try to get fetch directly
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Sep 15, 2023
1 parent 804f9ec commit 1ac0e0e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/auth/src/core/util/fetch_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ export class FetchProvider {
if (typeof self !== 'undefined' && 'fetch' in self) {
return self.fetch;
}
if (typeof globalThis !== 'undefined' && 'fetch' in globalThis) {
if (typeof globalThis !== 'undefined' && globalThis.fetch) {
return globalThis.fetch;
}
if (typeof fetch !== 'undefined') {
return fetch;
}
debugFail(
'Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
);
Expand All @@ -58,9 +61,12 @@ export class FetchProvider {
if (typeof self !== 'undefined' && 'Headers' in self) {
return self.Headers;
}
if (typeof globalThis !== 'undefined' && 'Headers' in globalThis) {
if (typeof globalThis !== 'undefined' && globalThis.Headers) {
return globalThis.Headers;
}
if (typeof Headers !== 'undefined') {
return Headers;
}
debugFail(
'Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
);
Expand All @@ -73,9 +79,12 @@ export class FetchProvider {
if (typeof self !== 'undefined' && 'Response' in self) {
return self.Response;
}
if (typeof globalThis !== 'undefined' && 'Response' in globalThis) {
if (typeof globalThis !== 'undefined' && globalThis.Response) {
return globalThis.Response;
}
if (typeof Response !== 'undefined') {
return Response;
}
debugFail(
'Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
);
Expand Down

0 comments on commit 1ac0e0e

Please sign in to comment.