diff options
Diffstat (limited to 'src/routes/(app)/post')
| -rw-r--r-- | src/routes/(app)/post/[...path]/+server.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/routes/(app)/post/[...path]/+server.ts b/src/routes/(app)/post/[...path]/+server.ts index 244683ee..2c3e6d18 100644 --- a/src/routes/(app)/post/[...path]/+server.ts +++ b/src/routes/(app)/post/[...path]/+server.ts @@ -3,10 +3,18 @@ import { auth } from "$lib/utils"; export async function POST({ cookies, fetch, params, request }) { const { path } = params; + const headers: Record<string, string> = { "Content-Type": "application/json" }; + + const authHeader = request.headers.get("authorization"); + if (authHeader) { + headers.authorization = authHeader; + } else { + Object.assign(headers, auth(cookies)); + } return fetch(`${base}/${path}`, { method: "POST", body: JSON.stringify(await request.json()), - headers: { "Content-Type": "application/json", ...auth(cookies) }, + headers, }); } |
