From 69a0f7e40ef36f9a1fb1654f171aa381a94a2877 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Sun, 22 Dec 2024 13:18:25 +0800 Subject: [PATCH] Update fetchInterceptor.ts --- packages/shared/src/request/fetchInterceptor.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/shared/src/request/fetchInterceptor.ts b/packages/shared/src/request/fetchInterceptor.ts index 1f272b2f740..72c0a7afb05 100644 --- a/packages/shared/src/request/fetchInterceptor.ts +++ b/packages/shared/src/request/fetchInterceptor.ts @@ -58,6 +58,7 @@ const newFetch = async function ( const isOneKeyDomain = await checkIsOneKeyDomain(url); let requestId: string | undefined; if (isOneKeyDomain) { + options.headers = options.headers || {}; const headers = await getRequestHeaders(); requestId = headers[HEADER_REQUEST_ID_KEY]; forEach(headers, (val, key) => { @@ -71,11 +72,6 @@ const newFetch = async function ( headers[key] = val; } // @ts-ignore - if (!options.headers) { - // @ts-ignore - options.headers = {}; - } - // @ts-ignore options.headers[key] = val; }); }