set statuscode to 204 if no content is send (#10569)

* set statuscode to 204 if no content is send

this is currently wrong for the DELETE Http Method in directus, which sends 200 status code although no content is served

* make linter happy

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
eikaramba
2021-12-24 03:59:56 +01:00
committed by GitHub
parent 589caf789b
commit 0ed76215b4

View File

@@ -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();
}
});