Comments (5)
Hey, can you
- recreate your code using https://runkit.com/gustavohenke/express-validator-issue-template, and
- provide examples of requests you are sending?
from express-validator.
Thanks for replying.
Please find required details
1. https://runkit.com/chidam02/66484103fded21000871b6c7
2. `const req = {
body: {
info:{
name: 'Project_1'
},
requirement: {
xssInput: '<script scr="someRandom"></script>',
fruitQuantity: 5,
vegQuantity: 2,
isGross: true
}
},
cookies: {},
headers: {
'Content-Type': 'application/json'
},
query: {},
params: {},
query: {},
};`
from express-validator.
Is your concern that non-string inputs such as req.body.requirement.fruitQuantity
are becoming string?
from express-validator.
Totally yes.
Because of this, usage of app.use(express.json()) or bodyParser becomes void.
from express-validator.
This is expected behaviour.
See here: https://express-validator.github.io/docs/guides/validation-chain#standard-validatorssanitizers
from express-validator.
Related Issues (20)
- Validate json object HOT 6
- Able to use validation inside controller? HOT 5
- How to use if inside ParamSchema? HOT 1
- Check if a field is either a string or an Array of Strings HOT 1
- Using oneOf together with checkExact causes Unknown Field errors HOT 2
- How to keep keys for optional fields in matchedData?
- Build failed in master branch HOT 2
- Return ValidationChain inside a function. HOT 1
- notEmpty Validation Fails to Detect Empty String with Spaces, Allowing Insertion of Empty String into Database" HOT 1
- Syntax error in example of ValidationError type in express-validator/src/base.ts
- Apply bail to the whole chain HOT 1
- The isIn method mismatch the expectation result HOT 2
- Bug: Object as input, IsInt returning no error and passing validation. HOT 2
- Please add index in Meta custom Validation HOT 2
- isEmpty is not a function of ResultWithContext[], despite documentation suggesting so
- Passing "YYYY-MM" (e.g. "2027-08") for date with isDate validation crashes HOT 1
- Error install HOT 1
- Calling `.trim().isString()` passes for numbers HOT 2
- In custom() validator, please add option not to include its value in response HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-validator.