Comments (5)
Hey bminer, thanks for your feedback!
For validation I agree, we should be able to use req.param(). For sanitization however things will become a bit more tricky since we actually want to modify the parameters and req.param() is read-only. So we somehow have to figure out, whether the param we want to sanitize is in req.params, req.query or req.body and write it back to the correct location...
Anyways I agree we should get rid of the mixinParams-method. If you want, you can provide me with a pull-request, otherwise I'll see if I can implement it during the weekend.
from express-validator.
Good point. I suppose you could just store back into req.param no matter
what, which is sort of what's happening right now. Or, you could do
something like req.param(...) -- first try replacing req.params[x] if it
exists, otherwise replace req.query[x], then req.body[x]... in that order.
The latter seems like a better approach since you can still access your
vars (sanitized or not) through req.body, req.params, and req.query, but you
can also access them via req.param(...).
I'm not too great with Git, and my time is extremely limited right now. I
could take care of this, but I'd probably just email you the code (I know...
gross). Let me know what you want me to do. If you can get to it this
weekend or whatever, that's fine with me, too. Thanks!
On Thu, Oct 20, 2011 at 8:50 AM, Christoph Tavan <
[email protected]>wrote:
Hey bminer, thanks for your feedback!
For validation I agree, we should be able to use req.param(). For
sanitization however things will become a bit more tricky since we actually
want to modify the parameters and req.param() is read-only. So we somehow
have to figure out, whether the param we want to sanitize is in req.params,
req.query or req.body and write it back to the correct location...Anyways I agree we should get rid of the mixinParams-method. If you want,
you can provide me with a pull-request, otherwise I'll see if I can
implement it during the weekend.Reply to this email directly or view it on GitHub:
#1 (comment)
from express-validator.
If you can wait until the end of the weekend, I'll implement your idea.
from express-validator.
Thank you very much! Awesome
from express-validator.
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.
from express-validator.
Related Issues (20)
- isDate() returns false on "2021-02-12" for express-validator v7 HOT 5
- Re-use validators on the front end? HOT 3
- How to pass parameters to a custom validator using schemas HOT 2
- TS Error. Type 'IsURLOptions' does not include some properties
- const {query} = require("express-validator") not working but {check} is working HOT 1
- How to stop the validation flow to different checks HOT 1
- How can I prevent isStrongPassword() accepting whitespaces? HOT 1
- 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
- The isIn method mismatch the expectation result HOT 2
- Bug: Object as input, IsInt returning no error and passing validation. HOT 2
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.