From fc92bcd897fa62deeb81bddfe0950b1ee0fe8466 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 23 Jul 2026 09:10:55 +0000 Subject: [PATCH] Fix POST without body: only set Content-Type when body present --- frontend/src/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 12c85d8..e8bb7a4 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -3,9 +3,10 @@ import type { DeptActuals, DeptScheduled, NetSalesDay, WageBudget, AppSetting } const BASE = '/wages/api' async function request(path: string, opts: RequestInit = {}): Promise { + const headers: Record = opts.body != null ? { 'Content-Type': 'application/json' } : {} const res = await fetch(`${BASE}${path}`, { credentials: 'include', - headers: { 'Content-Type': 'application/json', ...opts.headers }, + headers: { ...headers, ...opts.headers }, ...opts, }) if (res.status === 401) {