mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 00:51:20 +00:00
fix: handle malformed JSON in location handler
Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -29,7 +29,13 @@ export function registerLocationHttpHandlers(
|
||||
}
|
||||
|
||||
async function handleUpdateLocation(c: Context<Env>) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user