node-web-mvc
Version:
node spring mvc
26 lines (25 loc) • 1.05 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ContentNegotiationStrategy_1 = require("./ContentNegotiationStrategy");
const HeaderContentNegotiationStrategy_1 = __importDefault(require("./HeaderContentNegotiationStrategy"));
class ContentNegotiationManager {
constructor() {
this.strategies = [
new HeaderContentNegotiationStrategy_1.default(),
];
}
resolveMediaTypes(request) {
for (const strategy of this.strategies) {
const types = strategy.resolveMediaTypes(request);
if (types == ContentNegotiationStrategy_1.MEDIA_TYPE_ALL_LIST || (types === null || types === void 0 ? void 0 : types.length) < 1) {
continue;
}
return types;
}
return ContentNegotiationStrategy_1.MEDIA_TYPE_ALL_LIST;
}
}
exports.default = ContentNegotiationManager;