1
0
Fork 0
mirror of https://github.com/xHyroM/waki.git synced 2024-09-19 20:23:21 +02:00

fix: use api key search param instead of header

This commit is contained in:
Jozef Steinhübl 2024-07-17 17:41:38 +02:00
parent 1788e6d215
commit 9b0fd2b67b
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F

View file

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