We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
lib : 4.1, node : 8.1.4, os : ubuntu 14.04
Use legacy API (schema) for validation. My code:
export const validatePostPageData = async (req, res, next) => { /* POST data : { data : { props : "ABC" } } */ req.checkBody({ 'data.props' : { optional: true } }); const result = await req.getValidationResult(); if (!result.isEmpty()) { res.status(400).send({error: result.array().map(({param, msg}) => ({param, msg}))}); return; } next(); };
Displayed error in console: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'message' of undefined
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'message' of undefined
If remove the optional rule and add other - all work fine
The text was updated successfully, but these errors were encountered:
Thanks for the report. This is indeed a bug when using schema validation + optional as the first found key in a parameter object.
optional
Sorry, something went wrong.
21ef440
Fix published in v4.1.1.
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.
No branches or pull requests
lib : 4.1,
node : 8.1.4,
os : ubuntu 14.04
Use legacy API (schema) for validation.
My code:
Displayed error in console:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'message' of undefined
If remove the optional rule and add other - all work fine
The text was updated successfully, but these errors were encountered: