From 7c74762c2a8bebcc22f9cb1f34eda52ed6e09c94 Mon Sep 17 00:00:00 2001 From: Xylight Date: Sat, 27 Jul 2024 13:28:54 -0700 Subject: [PATCH] misc: force init headers --- src/lib/lemmy.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/lemmy.ts b/src/lib/lemmy.ts index 2a723e34..b84aa4e3 100644 --- a/src/lib/lemmy.ts +++ b/src/lib/lemmy.ts @@ -34,6 +34,12 @@ async function customFetch( ): Promise { const f = func ? func : fetch + if (init) + init.headers = { + ...init.headers, + ...(auth ? { authorization: `Bearer ${auth}` } : {}), + } + if (init?.body && auth) { try { const json = JSON.parse(init.body.toString())