diff --git a/api/src/middleware/respond.ts b/api/src/middleware/respond.ts index 385943bba3..d48b1ad458 100644 --- a/api/src/middleware/respond.ts +++ b/api/src/middleware/respond.ts @@ -80,8 +80,10 @@ export const respond: RequestHandler = asyncHandler(async (req, res) => { if (Buffer.isBuffer(res.locals.payload)) { return res.end(res.locals.payload); - } else { + } else if (res.locals.payload) { return res.json(res.locals.payload); + } else { + return res.status(204).end(); } });