node-web-mvc
Version:
node spring mvc
52 lines (51 loc) • 1.54 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const CorsConfiguration_1 = __importDefault(require("./CorsConfiguration"));
class CorsRegistration {
constructor(pathPattern) {
this.pathPattern = pathPattern;
this.config = new CorsConfiguration_1.default().applyPermitDefaultValues();
}
allowedOrigins(...origins) {
this.config.origins = origins || [];
return this;
}
allowedMethods(...methods) {
this.config.methods = methods || [];
return this;
}
allowedHeaders(...headers) {
this.config.allowedHeaders = headers || [];
return this;
}
exposedHeaders(...headers) {
this.config.exposedHeaders = headers || [];
return this;
}
allowCredentials(allowCredentials) {
this.config.allowCredentials = allowCredentials;
return this;
}
allowOriginPatterns(...patterns) {
this.config.originPatterns = patterns || [];
return this;
}
allowPrivateNetwork(allowPrivateNetwork) {
this.config.allowPrivateNetwork = allowPrivateNetwork;
return this;
}
maxAge(maxAge) {
this.config.maxAge = maxAge;
return this;
}
getPathPattern() {
return this.pathPattern;
}
getCorsConfiguration() {
return this.config;
}
}
exports.default = CorsRegistration;