-import * as express from 'express'
-import 'express-validator'
-import { getHostWithPort } from '../helpers/utils'
+import express from 'express'
+import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
+import { getHostWithPort } from '../helpers/express-utils'
function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.body.hosts) return next()
// Problem with the url parsing?
if (hostWithPort === null) {
- return res.sendStatus(500)
+ return res.fail({
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR_500,
+ message: 'Could not parse hosts'
+ })
}
req.body.hosts[i] = hostWithPort