changed 412 status code to 400

This commit is contained in:
Henry Oswald 2014-05-19 14:02:54 +01:00
parent de38cbf595
commit a53d767eca
2 changed files with 4 additions and 4 deletions

View file

@ -44,7 +44,7 @@ module.exports =
user.ace.pdfViewer = req.body.pdfViewer
user.save (err)->
if !newEmail? or newEmail.length == 0 or newEmail.indexOf("@") == -1
return res.send(412)
return res.send(400)
else if newEmail == user.email
return res.send 200
else

View file

@ -107,21 +107,21 @@ describe "UserController", ->
it "should return an error if the email address is null", (done)->
@req.body.email = null
@res.send = (code)->
code.should.equal 412
code.should.equal 400
done()
@UserController.updateUserSettings @req, @res
it "should send an error if the email is 0 len", (done)->
@req.body.email = ""
@res.send = (code)->
code.should.equal 412
code.should.equal 400
done()
@UserController.updateUserSettings @req, @res
it "should send an error if the email does not contain an @", (done)->
@req.body.email = "bob at something dot com"
@res.send = (code)->
code.should.equal 412
code.should.equal 400
done()
@UserController.updateUserSettings @req, @res