From daa6ec768184923d5d788857ea3c5f6690e8cd20 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Thu, 2 Oct 2025 11:54:33 -0700 Subject: [PATCH] Fix: Use robust JSON helper for header handling --- functions/api/signup.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/api/signup.js b/functions/api/signup.js index 652d006..c50afb0 100644 --- a/functions/api/signup.js +++ b/functions/api/signup.js @@ -1,4 +1,8 @@ -const json = (d, o) => new Response(JSON.stringify(d), { ...o, headers: { 'Content-Type': 'application/json', ...(o?.headers || {}) } }); +const json = (d, o = {}) => { + const h = new Headers(o.headers); + h.set('Content-Type', 'application/json'); + return new Response(JSON.stringify(d), { ...o, headers: h }); +}; export async function onRequestPost({ request, env }) { try {