"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__tsfTypeAliases = void 0;
exports.getHeaderValue = getHeaderValue;
exports.getRequestHeader = getRequestHeader;
exports.getRequestHeaderForParameter = getRequestHeaderForParameter;
function getHeaderValue(headers, name) {
    return headers[name.toLowerCase()];
}
function getRequestHeader(request, name) {
    return getHeaderValue(request.headers, name);
}
/**
 * Resolves a header for a route parameter, whose declared name may be
 * camelCase: `userAgent` matches `useragent`, then `user-agent`, then
 * `x-user-agent`.
 */
function getRequestHeaderForParameter(request, name) {
    const kebab = name.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`).replace(/^-/, '');
    return request.headers[name.toLowerCase()] ?? request.headers[kebab] ?? request.headers[`x-${kebab}`];
}
exports.__tsfTypeAliases = JSON.parse("[1,{\"HttpHeaderCarrier\":{\"kind\":18,\"typeName\":\"HttpHeaderCarrier\",\"types\":[{\"kind\":20,\"name\":\"readonly headers\",\"type\":{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":[{\"kind\":6},{\"kind\":6}],\"index\":{\"kind\":6},\"types\":[]},\"optional\":false}]}}]")[1];
//# sourceMappingURL=headers.js.map