"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setBodyHostsPort = void 0;
const express_utils_1 = require("../helpers/express-utils");
function setBodyHostsPort(req, res, next) {
    if (!req.body.hosts)
        return next();
    for (let i = 0; i < req.body.hosts.length; i++) {
        const hostWithPort = (0, express_utils_1.getHostWithPort)(req.body.hosts[i]);
        if (hostWithPort === null) {
            return res.fail({
                status: 500,
                message: 'Could not parse hosts'
            });
        }
        req.body.hosts[i] = hostWithPort;
    }
    return next();
}
exports.setBodyHostsPort = setBodyHostsPort;
//# sourceMappingURL=servers.js.map