From 2ac28348e2f7334e0dbb5f99d11fbb8a5d0ca78e Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Thu, 11 Jul 2024 17:34:30 +0200 Subject: [PATCH] refactor: assign fetch once (#709) chore: assign fetch once Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> --- src/fetch-wrapper.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/fetch-wrapper.ts b/src/fetch-wrapper.ts index 10682c2c0..f2048060e 100644 --- a/src/fetch-wrapper.ts +++ b/src/fetch-wrapper.ts @@ -25,10 +25,8 @@ export default function fetchWrapper( let status: number; let url: string; - let { fetch } = globalThis; - if (requestOptions.request?.fetch) { - fetch = requestOptions.request.fetch; - } + const fetch: typeof globalThis.fetch = + requestOptions.request?.fetch || globalThis.fetch; if (!fetch) { throw new Error(