Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

validator, checkParams does not work

See original GitHub issue
import expressValidator from 'express-validator';
  req.checkParams('type', 'type is valid').notEmpty().isIn(['gallery']);

the validator is not showing any signs of life, even when the improper type is passed in.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

gustavohenkecommented, Jan 20, 2017

This was always supported by express-validator:

req.checkQuery('bar').isLength({ min: 2, max: 10 });

const errors = req.validationErrors( true );
if ( errors ) console.log( errors );

Note that req.validationErrors() and req.asyncValidationErrors() have been deprecated because they are inconsistent and kinda flawed if compared to req.getValidationResult().

lock[bot]commented, Jun 2, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

req.checkQuery(' '); & req.checkParams(' '); for validate -> error ...
I am trying to use express-validator's req.checkQuery(''); req.checkParams('');. To simply check/ validate and make sure my query params are ...
Read more >
Validation middlewares - express-validator
The validators will always be executed serially for the same field. This means that if the chain targets more than one field, those...
Read more >
express-validator - npm
Starts the validation of the specifed parameter, will look for the parameter in req in the order params , query , body ,...
Read more >
How to use the express-validator/check.param function ... - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
Parameter validation API does not check params exhaustively
xennetworklabel is missing in the list of valid params, resulting in following errors in log. 2015-01-19 09:42:48,275 WARN ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found