chore(deps): update dependency @types/hapi__joi to v16.0.9 (#3185)
This commit is contained in:
@ -190,13 +190,11 @@ export const joi = (schema: Joi.Schema) => (
|
||||
next: express.NextFunction,
|
||||
) => {
|
||||
const { error } = schema.validate(req.body, { allowUnknown: true });
|
||||
const valid = error == null;
|
||||
|
||||
if (valid) {
|
||||
next();
|
||||
} else {
|
||||
if (error) {
|
||||
const { details } = error;
|
||||
const message = details.map(i => i.message).join(',');
|
||||
res.status(422).json({ error: message });
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user