From 963bf073d1b980c52e121362400268289cfc20bf Mon Sep 17 00:00:00 2001 From: kenneth Date: Sun, 22 Feb 2026 21:03:58 +0000 Subject: [PATCH] fix: handle malformed JSON in location handler Co-authored-by: Ona --- apps/aris-backend/src/location/http.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/aris-backend/src/location/http.ts b/apps/aris-backend/src/location/http.ts index 8d13c0a..083cbd8 100644 --- a/apps/aris-backend/src/location/http.ts +++ b/apps/aris-backend/src/location/http.ts @@ -29,7 +29,13 @@ export function registerLocationHttpHandlers( } async function handleUpdateLocation(c: Context) { - const body = await c.req.json() + let body: unknown + try { + body = await c.req.json() + } catch { + return c.json({ error: "Invalid JSON" }, 400) + } + const result = locationInput(body) if (result instanceof type.errors) {