From: Carl Worth Date: Thu, 11 Jun 2020 18:53:43 +0000 (-0700) Subject: Provide an explicit (empty) return body for some responses X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=99fe599c5e4efab0fd285bc58f39ea09e2655dad;p=empires-server Provide an explicit (empty) return body for some responses If we just do the numeric sendStatus(200) then node goes and sends a response with a body of "OK" rather than something empty. I don't necessarily want that, (and I notice that when I have spurious "OK" strings cluttering up my test-suite output). --- diff --git a/empathy.js b/empathy.js index 7dbf5d8..3a3f80d 100644 --- a/empathy.js +++ b/empathy.js @@ -228,7 +228,7 @@ router.post('/vote/:prompt_id([0-9]+)', (request, response) => { const prompt_id = parseInt(request.params.prompt_id, 10); if (game.toggle_vote(prompt_id, request.session.id)) - response.sendStatus(200); + response.send(''); else response.sendStatus(404); }); @@ -238,7 +238,7 @@ router.post('/start/:prompt_id([0-9]+)', (request, response) => { const prompt_id = parseInt(request.params.prompt_id, 10); if (game.start(prompt_id)) - response.sendStatus(200); + response.send(''); else response.sendStatus(404); });