From 9b0fd2b67b9b290561ec05c9839b374611090282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Wed, 17 Jul 2024 17:41:38 +0200 Subject: [PATCH] fix: use api key search param instead of header --- src/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9b43389..ac55029 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,14 +23,17 @@ export default { for (const provider of providers) { const url = new URL(provider.url); url.pathname += baseUrl.pathname; + url.searchParams.append("api_key", provider.token); + + const headers = new Headers(request.headers); + headers.delete("Authorization"); if (body !== null) { // @ts-expect-error expected res = await fetch(url.toString(), { method: request.method, headers: { - ...request.headers, - authorization: `Bearer ${btoa(provider.token)}`, + ...headers, }, body: body(), }); @@ -39,8 +42,7 @@ export default { res = await fetch(url.toString(), { method: request.method, headers: { - ...request.headers, - authorization: `Bearer ${btoa(provider.token)}`, + ...headers, }, }); }