From 037d969edcc468c748d8ebade533f4c0901688df Mon Sep 17 00:00:00 2001 From: Renan Pimentel Date: Mon, 5 Oct 2026 14:40:47 -0300 Subject: [PATCH] test: assert compression with Cache-Control lacking no-transform --- test/compression.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/compression.js b/test/compression.js index cf6b516..117c6cc 100644 --- a/test/compression.js +++ b/test/compression.js @@ -807,6 +807,24 @@ describe('compression()', function () { }) }) + describe('when "Cache-Control" response header without "no-transform"', function () { + ;['no-cache', 'public, max-age=60'].forEach(function (value) { + it('should compress response when "Cache-Control: ' + value + '"', function (done) { + var server = createServer({ threshold: 0 }, function (req, res) { + res.setHeader('Cache-Control', value) + res.setHeader('Content-Type', 'text/plain') + res.end('hello, world') + }) + + request(server) + .get('/') + .set('Accept-Encoding', 'gzip') + .expect('Cache-Control', value) + .expect('Content-Encoding', 'gzip', done) + }) + }) + }) + describe('.filter', function () { it('should be a function', function () { assert.strictEqual(typeof compression.filter, 'function')