There was an error while loading. Please reload this page.
1 parent 525c3ff commit 3c19b93Copy full SHA for 3c19b93
1 file changed
packages/network/src/fetch.ts
@@ -108,9 +108,11 @@ export function createApiKeyMiddleware({
108
const reqUrl = new URL(context.url);
109
if (!hostMatches(reqUrl.host, host)) return; // Skip middleware if host does not match pattern
110
111
- const headers = new Headers(context.init.headers);
+ const headers =
112
+ context.init.headers instanceof Headers
113
+ ? context.init.headers
114
+ : (context.init.headers = new Headers(context.init.headers));
115
headers.set(httpHeader, apiKey);
- context.init.headers = headers;
116
},
117
};
118
}
0 commit comments