Environment information
Version: Compression 1.8.1
Platform: MacOS 15.6
Node.js version: 22.15.1
Any other relevant information:
What steps will reproduce the bug?
- Setup a node server with the compression middleware. You can also set the filter method to always return false, to ensure it's not doing any compression.
- In the response handler, call response.writeHead(200, undefined, {'foo': 'bar'}). The status code and headers are not important. The important part is the
undefined status text
Observe how the response headers are not getting set at all.
If you change the status text from undefined to any string, the headers do get set.
If you leave the undefined status text, but remove the compression middleware, the headers do get set.
I've attached a repro case showing this. Just npm install and then run the test with node pure-node-compression-test.js
compression-repro.zip
Environment information
Version: Compression 1.8.1
Platform: MacOS 15.6
Node.js version: 22.15.1
Any other relevant information:
What steps will reproduce the bug?
undefinedstatus textObserve how the response headers are not getting set at all.
If you change the status text from undefined to any string, the headers do get set.
If you leave the undefined status text, but remove the compression middleware, the headers do get set.
I've attached a repro case showing this. Just
npm installand then run the test withnode pure-node-compression-test.jscompression-repro.zip