From f70b39a0b5e0bdc448a0540c2ac41f5480a0a54b Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 21 Feb 2025 18:32:57 +0530 Subject: [PATCH] fix: properly merge headers in fetchWithEvent --- src/utils/proxy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/proxy.ts b/src/utils/proxy.ts index bac34202..785ff5f0 100644 --- a/src/utils/proxy.ts +++ b/src/utils/proxy.ts @@ -166,11 +166,11 @@ export function fetchWithEvent< return getFetch(options?.fetch)(req, { ...init, context: init?.context || event.context, - headers: { - ...getProxyRequestHeaders(event, { + headers: mergeHeaders( + getProxyRequestHeaders(event, { host: typeof req === "string" && req.startsWith("/"), }), - ...init?.headers, - }, + init?.headers, + ), }); }