From 111453c07589564174ee52b32e3bcd55a08d4eac Mon Sep 17 00:00:00 2001 From: mserranom Date: Wed, 17 Jul 2019 09:25:29 +0000 Subject: [PATCH] server returns 422 on incorrect language GitOrigin-RevId: cce8d0274476aed2b48a6908df3a44a7ea9ff186 --- services/web/app/src/Features/Spelling/SpellingController.js | 2 +- .../web/test/unit/src/Spelling/SpellingControllerTests.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/Features/Spelling/SpellingController.js b/services/web/app/src/Features/Spelling/SpellingController.js index 3476bbe1f8..c875b25dd8 100644 --- a/services/web/app/src/Features/Spelling/SpellingController.js +++ b/services/web/app/src/Features/Spelling/SpellingController.js @@ -13,7 +13,7 @@ module.exports = { const { language } = req.body if (language && !languageCodeIsSupported(language)) { logger.info({ language }, `language not supported`) - return res.status(200).send(JSON.stringify({ misspellings: [] })) + return res.status(422).send(JSON.stringify({ misspellings: [] })) } const userId = AuthenticationController.getLoggedInUserId(req) diff --git a/services/web/test/unit/src/Spelling/SpellingControllerTests.js b/services/web/test/unit/src/Spelling/SpellingControllerTests.js index b899edd37c..ecb1afba1e 100644 --- a/services/web/test/unit/src/Spelling/SpellingControllerTests.js +++ b/services/web/test/unit/src/Spelling/SpellingControllerTests.js @@ -110,8 +110,8 @@ describe('SpellingController', function() { .should.equal(true) }) - it('should return a 200 status', function() { - this.res.status.calledWith(200).should.equal(true) + it('should return a 422 status', function() { + this.res.status.calledWith(422).should.equal(true) }) }) })