]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/utils.ts
Send video comment comments to followers/origin
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / utils.ts
CommitLineData
69818c93 1import * as express from 'express'
a2431b7d 2import { validationResult } from 'express-validator/check'
65fcc311 3import { logger } from '../../helpers'
c45f7f84 4
4e50b6a1
C
5function areValidationErrors (req: express.Request, res: express.Response) {
6 const errors = validationResult(req)
7
8 if (!errors.isEmpty()) {
9 logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors.mapped() })
10 res.status(400).json({ errors: errors.mapped() })
11
12 return true
13 }
14
15 return false
16}
17
9f10b292 18// ---------------------------------------------------------------------------
c45f7f84 19
65fcc311 20export {
4e50b6a1 21 areValidationErrors
65fcc311 22}