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; }); }