caching_middleware: use test instead of match

This commit is contained in:
webzwo0i 2020-11-20 00:56:13 +01:00
parent c42616006b
commit 8e6311055c

View file

@ -196,7 +196,7 @@ CachingMiddleware.prototype = new function () {
var statusCode = responseCache[cacheKey].statusCode; var statusCode = responseCache[cacheKey].statusCode;
var pathStr = CACHE_DIR + 'minified_' + cacheKey; var pathStr = CACHE_DIR + 'minified_' + cacheKey;
if (supportsGzip && (headers['content-type'] || '').match(/^application\/javascript/)) { if (supportsGzip && /^application\/javascript/.test(headers['content-type'])) {
pathStr = pathStr + '.gz'; pathStr = pathStr + '.gz';
headers['content-encoding'] = 'gzip'; headers['content-encoding'] = 'gzip';
} else { } else {