From fc4b89c6bd1ae3c0b73277f60a1a69ef6a04642d Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Thu, 19 Dec 2024 22:35:13 +0100 Subject: [PATCH] fix: set written status code and X-SVRJS-Cache header when no header is passed to res.writeHead() --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index dfa8a4c..4c0502d 100644 --- a/src/index.js +++ b/src/index.js @@ -81,9 +81,9 @@ module.exports = function (req, res, logFacilities, config, next) { Object.keys(properHeaders).forEach((key) => { writtenHeaders[key.toLowerCase()] = properHeaders[key]; }); - writtenStatusCode = statusCode; - res.setHeader("X-SVRJS-Cache", "MISS"); } + writtenStatusCode = statusCode; + res.setHeader("X-SVRJS-Cache", "MISS"); if (headers) { originalWriteHead( writtenStatusCode,