mirror of
https://github.com/xHyroM/waki.git
synced 2024-11-10 01:18:07 +01:00
fix: use api key search param instead of header
This commit is contained in:
parent
1788e6d215
commit
9b0fd2b67b
1 changed files with 6 additions and 4 deletions
10
src/index.ts
10
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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue