Save a copy of the headers not the original.

Otherwise ExpressJS will complain about trying to modify
headers that have already been sent.
This commit is contained in:
D. Berge
2023-09-24 12:17:16 +02:00
parent 2069d9c3d7
commit 0829ea3ea1

View File

@@ -33,7 +33,7 @@ function saveResponse (res) {
const cache = getCache(res);
const req = res.req;
console.log(`Saving ETag: ${req.method} ${req.url}${etag}`);
const headers = res.getHeaders();
const headers = structuredClone(res.getHeaders());
delete headers["set-cookie"];
cache[req.url] = {etag, headers};
}