expressjs / expressjs/compression
Compression middleware changes behavior of undefined statusText in writeHead
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 255
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 3
Description
## 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?
1. 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.
2. 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](https://github.com/user-attachments/files/22171472/compression-repro.zip)
Contributor guide
Assessment
This issue has not been assessed yet.