Innovenergy_trunk/frontend/node_modules/testcafe-hammerhead/lib/request-pipeline/index.js

26 lines
961 B
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
const context_1 = __importDefault(require("./context"));
const http_1 = require("../utils/http");
const logger_1 = __importDefault(require("../utils/logger"));
const stages_1 = __importDefault(require("./stages"));
async function run(req, res, serverInfo, openSessions, proxyless) {
const ctx = new context_1.default(req, res, serverInfo, proxyless);
logger_1.default.proxy.onRequest(ctx);
if (!ctx.dispatch(openSessions)) {
logger_1.default.proxy.onRequestError(ctx);
(0, http_1.respond404)(res);
return;
}
for (let i = 0; i < stages_1.default.length; i++) {
await stages_1.default[i](ctx);
if (!ctx.goToNextStage)
return;
}
}
exports.run = run;