This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //you see i console the all allParams in the create action. if i submit the form with empty value | |
| //the comsole will be {username: '',email:'' .......}.i think if the value == '',this will directly return the badRequest to | |
| //client. the problem is very strange.i did not write anything to stop the create.if the next() run, i should be run the User.create//(),right?because the form is empty, the User.create will throw the some error,like the username should not be empty. | |
| //policy | |
| module.exports = function(req, res, next) { | |
| for(var value in req.allParams()){ | |
| if(value == ""){ | |
| console.log(value); | |
| return res.badRequest('some input value is empty'); |