From 00d09fd6f5848baf4408cb5a01674903f3be8f78 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Mon, 22 Jul 2019 12:15:07 +0100 Subject: [PATCH] Return 204 instead of 200 when [un]learning words Also remove unnecessary calls to `next()` --- services/spelling/app/js/SpellingAPIController.js | 6 ++---- services/spelling/test/acceptance/js/LearnTest.js | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/services/spelling/app/js/SpellingAPIController.js b/services/spelling/app/js/SpellingAPIController.js index e23b09da5d..f771a7a567 100644 --- a/services/spelling/app/js/SpellingAPIController.js +++ b/services/spelling/app/js/SpellingAPIController.js @@ -44,8 +44,7 @@ module.exports = { if (error != null) { return next(error) } - res.sendStatus(200) - next() + res.sendStatus(204) }) }, @@ -57,8 +56,7 @@ module.exports = { if (error != null) { return next(error) } - res.sendStatus(200) - next() + res.sendStatus(204) }) }, diff --git a/services/spelling/test/acceptance/js/LearnTest.js b/services/spelling/test/acceptance/js/LearnTest.js index 8e363b4e10..b37efc5e80 100644 --- a/services/spelling/test/acceptance/js/LearnTest.js +++ b/services/spelling/test/acceptance/js/LearnTest.js @@ -33,9 +33,9 @@ const deleteDict = () => }) describe('learning words', () => { - it('should return status 200 when posting a word successfully', async () => { + it('should return status 204 when posting a word successfully', async () => { const response = await learnWord('abcd') - expect(response.statusCode).to.equal(200) + expect(response.statusCode).to.equal(204) }) it('should return no misspellings after a word is learnt', async () => { @@ -61,9 +61,9 @@ describe('learning words', () => { }) describe('unlearning words', () => { - it('should return status 200 when posting a word successfully', async () => { + it('should return status 204 when posting a word successfully', async () => { const response = await unlearnWord('anything') - expect(response.statusCode).to.equal(200) + expect(response.statusCode).to.equal(204) }) it('should return misspellings after a word is unlearnt', async () => {