mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Fixing formatting, using express.Request since it is now extended properly
This commit is contained in:
@@ -9,7 +9,7 @@ var app = express();
|
||||
|
||||
app.use(expressValidator());
|
||||
|
||||
app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: express.Response) {
|
||||
app.post('/:urlparam', function(req: express.Request, res: express.Response) {
|
||||
|
||||
// checkBody only checks req.body; none of the other req parameters
|
||||
// Similarly checkParams only checks in req.params (URL params) and
|
||||
@@ -17,17 +17,17 @@ app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: exp
|
||||
req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt();
|
||||
req.checkParams('urlparam', 'Invalid urlparam').isAlpha();
|
||||
req.checkQuery('getparam', 'Invalid getparam').isInt();
|
||||
req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase();
|
||||
req.checkFiles('testFiles', 'Invalid testFiles').isUrl();
|
||||
req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase();
|
||||
req.checkFiles('testFiles', 'Invalid testFiles').isUrl();
|
||||
|
||||
|
||||
// OR assert can be used to check on all 3 types of params.
|
||||
// OR assert can be used to check on all 3 types of params.
|
||||
// req.assert('postparam', 'Invalid postparam').notEmpty().isInt();
|
||||
// req.assert('urlparam', 'Invalid urlparam').isAlpha();
|
||||
// req.assert('getparam', 'Invalid getparam').isInt();
|
||||
|
||||
req.sanitize('postparam').toBoolean();
|
||||
req.filter('postparam').toBoolean();
|
||||
req.filter('postparam').toBoolean();
|
||||
|
||||
var errors = req.validationErrors();
|
||||
var mappedErrors = req.validationErrors(true);
|
||||
|
||||
Reference in New Issue
Block a user