packages: If a client sets Accept-Encoding: gzip, the responseCache will

include `Content-Encoding: gzip` in all future responses, even
if a subsequent request does not set `Accept-Encoding` or another client
requests the file without setting `Accept-Encoding`.
Fix that.
This commit is contained in:
webzwo0i 2020-11-16 02:25:44 +01:00
parent b73d3b7243
commit c42616006b

View file

@ -199,6 +199,9 @@ CachingMiddleware.prototype = new function () {
if (supportsGzip && (headers['content-type'] || '').match(/^application\/javascript/)) {
pathStr = pathStr + '.gz';
headers['content-encoding'] = 'gzip';
} else {
// ensure responseCache is updated
delete headers['content-encoding'];
}
var lastModified = (headers['last-modified']