zan-proxy
Version:
26 lines • 781 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const url_1 = __importDefault(require("url"));
function default_1(req) {
const url = url_1.default.parse(req.url);
let port = url.port || 80;
if (url.protocol && url.protocol.startsWith('https')) {
port = 443;
}
return {
auth: url.auth,
headers: req.headers,
host: url.host,
hostname: url.hostname,
method: req.method,
path: url.path,
port,
protocol: url.protocol,
rejectUnauthorized: false,
};
}
exports.default = default_1;
//# sourceMappingURL=convert.js.map
;