fix: fix header name casing inconsistencies causing wrong caching behavior

This commit is contained in:
Dorian Niemiec 2024-12-18 19:11:01 +01:00
parent 5b5f7bb0e7
commit 3fc7b30ccd

View file

@ -76,10 +76,10 @@ module.exports = function (req, res, logFacilities, config, next) {
let maximumCachedResponseSizeExceeded = false;
res.writeHead = function (statusCode, statusCodeDescription, headers) {
writtenHeaders = Object.assign(
writtenHeaders,
headers ? headers : statusCodeDescription
);
const properHeaders = headers ? headers : statusCodeDescription;
Object.keys(properHeaders).forEach((key) => {
writtenHeaders[key.toLowerCase()] = properHeaders[key];
});
writtenStatusCode = statusCode;
res.setHeader("X-SVRJS-Cache", "MISS");
if (headers) {