diff --git a/src/Application.ts b/src/Application.ts index d1a6d5f..b382fe5 100644 --- a/src/Application.ts +++ b/src/Application.ts @@ -102,16 +102,16 @@ export default abstract class Application implements Extendable { - res.status(401); + res.status(400); res.json({ status: 'error', - code: 401, + code: 400, message: 'Invalid form data', messages: bag.getMessages(), }); }, text: () => { - res.status(401); + res.status(400); res.send('Error: ' + bag.getMessages()); }, html: () => { diff --git a/test/Authentication.test.ts b/test/Authentication.test.ts index d48f7e1..4ec5e4d 100644 --- a/test/Authentication.test.ts +++ b/test/Authentication.test.ts @@ -135,7 +135,7 @@ describe('Register with username', () => { password_confirmation: 'horde_prime_will_rise', terms: 'on', }) - .expect(401); + .expect(400); // username field should be translated from identifier expect(res.body.messages?.username?.name).toStrictEqual('AlreadyExistsValidationError');