azurite
Version:
An open source Azure Storage API compatible server
52 lines • 1.35 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
class ExpressResponseAdapter {
constructor(res) {
this.res = res;
}
setStatusCode(code) {
this.res.status(code);
return this;
}
getStatusCode() {
return this.res.statusCode;
}
setStatusMessage(message) {
this.res.statusMessage = message;
return this;
}
getStatusMessage() {
return this.res.statusMessage;
}
setHeader(field, value) {
if (typeof value === "number") {
value = `${value}`;
}
if (typeof value === "boolean") {
value = `${value}`;
}
// Cannot remove if block because of a potential TypeScript bug
if (typeof value === "string" || value instanceof Array) {
this.res.setHeader(field, value);
}
return this;
}
getHeader(field) {
return this.res.getHeader(field);
}
getHeaders() {
return this.res.getHeaders();
}
headersSent() {
return this.res.headersSent;
}
setContentType(value) {
this.res.setHeader("content-type", value);
return this;
}
getBodyStream() {
return this.res;
}
}
exports.default = ExpressResponseAdapter;
//# sourceMappingURL=ExpressResponseAdapter.js.map
;