Can't use optional with sanitizers.
Closed this issue · 1 comments
pongib commented
This is my code
const getValidation = function* (next) {
this.checkQuery('limit').optional().len(1, 100).trim().toInt()
this.checkQuery('offset').optional().len(1, 100).trim().toInt()
if (this.errors) {
this.status = 400
this.body = this.errors
return
}
yield next
}
router.get('/something', getValidation, Ctrl.get)
When I send GET without offset
query params, It will populate error with TypeError: This library (validator.js) validates strings only
. If I did something wrong just point me to correct please. Thank you.
RocksonZeta commented
thanks, this bug has been fixed at 1.0.7 .