Skip to content

Commit

Permalink
feat: failover from native fetch to node-fetch (#481)
Browse files Browse the repository at this point in the history
Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com>
  • Loading branch information
baoshan and wolfy1339 committed Jul 11, 2022
1 parent b18514a commit d000a0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/fetch-wrapper.ts
Expand Up @@ -27,7 +27,9 @@ export default function fetchWrapper(
let url: string;

const fetch: typeof nodeFetch =
(requestOptions.request && requestOptions.request.fetch) || nodeFetch;
(requestOptions.request && requestOptions.request.fetch) ||
globalThis.fetch ||
/* istanbul ignore next */ nodeFetch;

return fetch(
requestOptions.url,
Expand Down Expand Up @@ -115,7 +117,6 @@ export default function fetchWrapper(

return getResponseData(response);
})

.then((data) => {
return {
status,
Expand All @@ -124,7 +125,6 @@ export default function fetchWrapper(
data,
};
})

.catch((error) => {
if (error instanceof RequestError) throw error;

Expand Down

0 comments on commit d000a0a

Please sign in to comment.