chore(deps): update dependency @types/hapi__joi to v16.0.9 (#3185)
This commit is contained in:
parent
9c76a140c7
commit
b71c496d97
@ -32,7 +32,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cors": "^2.8.6",
|
"@types/cors": "^2.8.6",
|
||||||
"@types/express": "^4.17.2",
|
"@types/express": "^4.17.2",
|
||||||
"@types/hapi__joi": "16.0.6",
|
"@types/hapi__joi": "16.0.9",
|
||||||
"@types/jest": "^24.9.0",
|
"@types/jest": "^24.9.0",
|
||||||
"@types/morgan": "^1.7.37",
|
"@types/morgan": "^1.7.37",
|
||||||
"@types/node": "^13.1.7",
|
"@types/node": "^13.1.7",
|
||||||
|
@ -190,13 +190,11 @@ export const joi = (schema: Joi.Schema) => (
|
|||||||
next: express.NextFunction,
|
next: express.NextFunction,
|
||||||
) => {
|
) => {
|
||||||
const { error } = schema.validate(req.body, { allowUnknown: true });
|
const { error } = schema.validate(req.body, { allowUnknown: true });
|
||||||
const valid = error == null;
|
if (error) {
|
||||||
|
|
||||||
if (valid) {
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
const { details } = error;
|
const { details } = error;
|
||||||
const message = details.map(i => i.message).join(',');
|
const message = details.map(i => i.message).join(',');
|
||||||
res.status(422).json({ error: message });
|
res.status(422).json({ error: message });
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2978,10 +2978,10 @@
|
|||||||
"@types/minimatch" "*"
|
"@types/minimatch" "*"
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/hapi__joi@16.0.6":
|
"@types/hapi__joi@16.0.9":
|
||||||
version "16.0.6"
|
version "16.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/@types/hapi__joi/-/hapi__joi-16.0.6.tgz#aa8f7dff93fdd3db6506ca2433a8302d8819fad1"
|
resolved "https://registry.yarnpkg.com/@types/hapi__joi/-/hapi__joi-16.0.9.tgz#0ad11f9de3753748444ac16249a264fc7c798ab4"
|
||||||
integrity sha512-rpU8FNMGxhYIF6bUlxZYO4drNjqUWCGrf4UINABAJzdcrPs4bP+Bz5VXzp8rOPZsNynnaDXbiU/MyjOGlfeczg==
|
integrity sha512-FV+rJxm4UBxBsRvT5hpiRvnxbpi9iJu4qdwXQvNXf6eXJkcgKGlTwHnstIDAxSTKTUMSmpJnyXpr6XI9X/4SjA==
|
||||||
|
|
||||||
"@types/history@*":
|
"@types/history@*":
|
||||||
version "4.7.5"
|
version "4.7.5"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user