Bladeren bron

Return 204 instead of 200 when [un]learning words

Also remove unnecessary calls to `next()`
Simon Detheridge 7 jaren geleden
bovenliggende
commit
00d09fd6f5

+ 2 - 4
services/spelling/app/js/SpellingAPIController.js

@@ -44,8 +44,7 @@ module.exports = {
       if (error != null) {
       if (error != null) {
         return next(error)
         return next(error)
       }
       }
-      res.sendStatus(200)
-      next()
+      res.sendStatus(204)
     })
     })
   },
   },
 
 
@@ -57,8 +56,7 @@ module.exports = {
       if (error != null) {
       if (error != null) {
         return next(error)
         return next(error)
       }
       }
-      res.sendStatus(200)
-      next()
+      res.sendStatus(204)
     })
     })
   },
   },
 
 

+ 4 - 4
services/spelling/test/acceptance/js/LearnTest.js

@@ -33,9 +33,9 @@ const deleteDict = () =>
   })
   })
 
 
 describe('learning words', () => {
 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')
     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 () => {
   it('should return no misspellings after a word is learnt', async () => {
@@ -61,9 +61,9 @@ describe('learning words', () => {
 })
 })
 
 
 describe('unlearning 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')
     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 () => {
   it('should return misspellings after a word is unlearnt', async () => {