diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d03534f4..45655c24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: test: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: name: - Node.js 0.8 diff --git a/index.js b/index.js index 198c85b4..c0638e08 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,7 @@ var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/ var SUPPORTED_ENCODING = hasBrotliSupport ? ['br', 'gzip', 'deflate', 'identity'] : ['gzip', 'deflate', 'identity'] var PREFERRED_ENCODING = hasBrotliSupport ? ['br', 'gzip'] : ['gzip'] -var encodingSupported = ['*', 'gzip', 'deflate', 'identity', 'br'] +var encodingSupported = ['gzip', 'deflate', 'identity', 'br'] /** * Compress response data with gzip / deflate. @@ -200,7 +200,7 @@ function compression (options) { // if no method is found, use the default encoding if (!req.headers['accept-encoding'] && encodingSupported.indexOf(enforceEncoding) !== -1) { - method = enforceEncoding === '*' ? 'gzip' : enforceEncoding + method = enforceEncoding } // negotiation failed diff --git a/test/compression.js b/test/compression.js index c2c11153..8107def0 100644 --- a/test/compression.js +++ b/test/compression.js @@ -960,7 +960,7 @@ describe('compression()', function () { .expect(200, 'hello, world', done) }) - it('should be gzip if no accept-encoding is sent when enforceEncoding is *', function (done) { + it('should not compress when enforceEnconding is *', function (done) { var server = createServer({ threshold: 0, enforceEncoding: '*' }, function (req, res) { res.setHeader('Content-Type', 'text/plain') res.end('hello, world') @@ -969,8 +969,8 @@ describe('compression()', function () { request(server) .get('/') .set('Accept-Encoding', '') - .expect('Content-Encoding', 'gzip') - .expect(200, 'hello, world', done) + .expect(shouldNotHaveHeader('Content-Encoding')) + .expect(200, done) }) }) })