1 import * as express from 'express'
2 import 'express-validator'
3 import { getHostWithPort } from '../helpers/express-utils'
5 function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
6 if (!req.body.hosts) return next()
8 for (let i = 0; i < req.body.hosts.length; i++) {
9 const hostWithPort = getHostWithPort(req.body.hosts[i])
11 // Problem with the url parsing?
12 if (hostWithPort === null) {
13 return res.sendStatus(500)
16 req.body.hosts[i] = hostWithPort
22 // ---------------------------------------------------------------------------