From 2f232a184e278fc78a4dae06e548c8dfeed3a4c8 Mon Sep 17 00:00:00 2001 From: Gabriel Ruschel <grc15@inf.ufpr.br> Date: Thu, 11 May 2017 10:32:13 -0300 Subject: [PATCH] Add response codes --- src/libs/routes/user.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/routes/user.js b/src/libs/routes/user.js index c8320c0d..3cc32f56 100644 --- a/src/libs/routes/user.js +++ b/src/libs/routes/user.js @@ -23,6 +23,7 @@ function emailSyntax(email) { userApp.post('/', (req, res, next) => { if(req.body.email){ if(!emailSyntax(req.body.email)){ + res.status = 400; res.json({success: false, msg: 'O email informado é inválido.'}); } else { next(); @@ -99,6 +100,7 @@ userApp.post('/', (req, res, next) => { userApp.post('/authenticate', (req, res, next) => { if (!req.body.email) { + res.status = 400; res.json({success: false, msg: 'O campo Email é obrigatório.'}); } else { next(); @@ -106,6 +108,7 @@ userApp.post('/authenticate', (req, res, next) => { }, (req, res, next) => { if (!req.body.password) { + res.status = 400; res.json({success: false, msg: 'O campo Senha é obrigatório.'}); } else { next(); -- GitLab