fix(shell): server: use empty obj instead of JSON.parse() when no content

This commit is contained in:
Il Harper 2024-04-29 23:37:54 +08:00
parent 30229d65aa
commit 47d0d13e9f
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC

View File

@ -336,7 +336,7 @@ function buildRouteCtx(
const string = () => buffer().then((b) => b.toString('utf-8')) const string = () => buffer().then((b) => b.toString('utf-8'))
const json = () => string().then((s) => JSON.parse(s) as unknown) const json = () => string().then((s) => (s ? (JSON.parse(s) as unknown) : {}))
return { return {
cctx, cctx,