feat: add backwards compatibility for POST requests

This commit is contained in:
Xyphyn committed 2023-10-02 16:03:18 -07:00
1 parent c843d8bb45
commit 93e144a837
2 files changed
+74 -30

No files matched your search

+6 -1
View File
@@ -33,8 +33,13 @@ async function customFetch(
): Promise<Response> {
const f = func ? func : fetch
const url = toURL(input)
if (init?.body && auth) {
const json = JSON.parse(init.body.toString())
json.auth = auth
init.body = JSON.stringify(json)
}
const url = toURL(input)
if (auth && url) url.searchParams.set('auth', auth)
const res = await f(url ?? input, init)