Skip to content

Commit 53148d7

Browse files
fix fetch structure
1 parent eed0cc6 commit 53148d7

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/database-shell/src/client.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ export function createShellClient(opts: {
1313
}): Client {
1414
return createClient({
1515
...opts,
16-
fetch: (input, init) => {
17-
const req = new Request(input, init);
18-
req.headers.set("User-Agent", USER_AGENT);
19-
return fetch(req);
16+
fetch: (input: string | Request | URL, init?: RequestInit) => {
17+
const headers = new Headers(init?.headers);
18+
if (input instanceof Request) {
19+
input.headers.forEach((v, k) => headers.set(k, v));
20+
}
21+
headers.set("User-Agent", USER_AGENT);
22+
return fetch(input, { ...init, headers });
2023
},
2124
});
2225
}

0 commit comments

Comments
 (0)