misc: force init headers
This commit is contained in:
1 parent
3803649d93
commit
7c74762c2a
1 file changed
+6
@@ -34,6 +34,12 @@ async function customFetch(
|
|||||||
): Promise<Response> {
|
): Promise<Response> {
|
||||||
const f = func ? func : fetch
|
const f = func ? func : fetch
|
||||||
|
|
||||||
|
if (init)
|
||||||
|
init.headers = {
|
||||||
|
...init.headers,
|
||||||
|
...(auth ? { authorization: `Bearer ${auth}` } : {}),
|
||||||
|
}
|
||||||
|
|
||||||
if (init?.body && auth) {
|
if (init?.body && auth) {
|
||||||
try {
|
try {
|
||||||
const json = JSON.parse(init.body.toString())
|
const json = JSON.parse(init.body.toString())
|
||||||
|
|||||||
Reference in new issue
Block a user