@enter-at/lambda-handlers
Version:
An opinionated Typescript package that facilitates specifying AWS Lambda handlers including input validation, error handling and response formatting.
17 lines (16 loc) • 477 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CORSHeader = void 0;
class CORSHeader {
constructor(origin = "*", credentials = false) {
this.origin = origin;
this.credentials = credentials;
}
create() {
return {
"Access-Control-Allow-Origin": this.origin,
...(this.credentials && { "Access-Control-Allow-Credentials": true }),
};
}
}
exports.CORSHeader = CORSHeader;