@studyportals/sp-r2d2
Version:
A framework that contains various components used when developing projects that will be deployed via AWS λ.
27 lines • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpResponse = void 0;
class HttpResponse {
get headers() {
return this.includeCorsHeaders ? Object.assign(Object.assign({}, this._headers), this.corsHeaders) : this._headers;
}
get corsHeaders() {
return null === this._corsHeaders ? this.defaultCorsHeaders : this._corsHeaders;
}
get defaultCorsHeaders() {
return {
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': 'true',
};
}
constructor(statusCode, body = {}, headers = {}, includeCorsHeaders = true, corsHeaders = null) {
this.statusCode = statusCode;
this.body = body;
this.includeCorsHeaders = includeCorsHeaders;
this._headers = headers;
this._corsHeaders = corsHeaders;
}
}
exports.HttpResponse = HttpResponse;
//# sourceMappingURL=http-response.class.js.map