-
-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isEmpty() not working properly #336
Comments
Just found out that with express-validator, the function to be used is notEmpty(). This should be explicitly displayed in the readme.md to avoid further confussions. |
Feel free to send us a PR to handle this. |
If you send a post variable, this pass if is an empty string '' |
I believe the docs are now a lot better since the v4.0.0 release, and such clarifications will no longer be required. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi, I'm trying to use the isEmpty() method but it always returns error, implying that the validated param is empty, even when it isn't. I've used isEmail() and isLength() methods without any issues. However, Using isEmpty() with the 'validator' npm module directly works properly, so it is an issue in express-validator.
Here's my config:
//
var expressValidator = require('express-validator');
.
.
.
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.use(expressValidator());
.
.
.
req.checkBody('name', 'Error: name is empty').isEmpty();
There's an open question by someone else in StackOverflow with the same issue: http://stackoverflow.com/questions/43417664/express-validator-isempty-not-working
Please check.
The text was updated successfully, but these errors were encountered: