From e150f7d26fb076bcdfb1832013ecbff2b93b060d Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 20 May 2024 15:24:29 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20override=20headers=20with=20cust?= =?UTF-8?q?om=20headers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/util/fetchWithOptions.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/util/fetchWithOptions.ts b/core/util/fetchWithOptions.ts index 661c326d9..c7dd9e5aa 100644 --- a/core/util/fetchWithOptions.ts +++ b/core/util/fetchWithOptions.ts @@ -59,10 +59,14 @@ export function fetchwithRequestOptions( : new HttpProxyAgent(proxy, agentOptions) : new protocol.Agent(agentOptions); - const headers: { [key: string]: string } = requestOptions?.headers || {}; + let headers: { [key: string]: string } = {}; for (const [key, value] of Object.entries(init?.headers || {})) { headers[key] = value as string; } + headers = { + ...headers, + ...requestOptions?.headers, + }; // Replace localhost with 127.0.0.1 if (url.hostname === "localhost") {