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.
pull/4491/head
webzwo0i 2020-11-16 02:25:44 +01:00
parent b73d3b7243
commit c42616006b
1 changed files with 3 additions and 0 deletions

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']