Skip to content

Commit

Permalink
refactor(node): store a local reference of fetch as a wrapper to allo…
Browse files Browse the repository at this point in the history
…w patching
  • Loading branch information
dwightjack committed Mar 22, 2024
1 parent 60e29ab commit 4026829
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export function createNodeFetch() {
};
}

export const fetch = globalThis.fetch || createNodeFetch();
export const fetch =
((...args: Parameters<typeof globalThis.fetch>) =>
globalThis.fetch(...args)) || createNodeFetch();

export const Headers = globalThis.Headers || _Headers;
export const AbortController = globalThis.AbortController || _AbortController;
Expand Down

0 comments on commit 4026829

Please sign in to comment.