request-guardian 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,4 +79,8 @@ app.listen(3000, () => {
|
|
|
79
79
|
});
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
If no validation rules are found for the current route, `request-guardian` will simply pass the request to the next middleware function in the stack.
|
|
82
|
+
If no validation rules are found for the current route, `request-guardian` will simply pass the request to the next middleware function in the stack.
|
|
83
|
+
|
|
84
|
+
## Keywords
|
|
85
|
+
|
|
86
|
+
express validator validation validate sanitize sanitization xss
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ const { validationResult, ValidationChain } = require('express-validator');
|
|
|
2
2
|
|
|
3
3
|
async function validate(req, res, next) {
|
|
4
4
|
try {
|
|
5
|
-
let validations = require('../utils/
|
|
5
|
+
let validations = require('../utils/validations/index.js')[req.path];
|
|
6
6
|
if (!validations) return next();
|
|
7
7
|
for (let validation of validations) {
|
|
8
8
|
const result = await validation.run(req);
|