@qaflag/core
Version:
Base requirements for the QA Flag library
33 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpContext = void 0;
const values_1 = require("../value/values");
const context_abstract_1 = require("./context.abstract");
class HttpContext extends context_abstract_1.Context {
constructor(scenario, response) {
super(scenario);
this.scenario = scenario;
this.response = response;
}
get statusCode() {
return new values_1.NumericValue(this.response.status.code, {
name: 'HTTP Status Code',
context: this,
});
}
header(name) {
const header = this.response.headers.find(({ key }) => key.toLocaleLowerCase() == name.toLocaleLowerCase());
return new values_1.StringValue(header ? header.value : '', {
name: `HTTP Header: ${name}`,
context: this,
});
}
get requestDuration() {
return new values_1.NumericValue(this.response.duration, {
name: 'Request Duration',
context: this,
});
}
}
exports.HttpContext = HttpContext;
//# sourceMappingURL=http-context.abstract.js.map