Closed danielgindi closed 3 months ago
@dougwilson Would you mind adding a minor change to accepts
if/when this PR is merged? This will save some time. Then I'll revert the brotli branch to use accepts
module with a simple extra argument.
@dougwilson thanks for shepherding this along.
After merging this I was looking at the api and realized we are limiting ourselves by passing an array directly, so I wrapped it in an options object so we have less of a chance of needing to break that api in future changes. That is what I will release with 1.0.
@blakeembrey This PR can be backported to version 0; it is necessary for express/compression
to have this feature in order to correctly handle the request encodings and thus add Brotli support
@bjohansebas any reason compression can’t be bumped to 1.0 and do its own major release for the feature?
jshttp/negotiator
and jshttp/accepts
removed support for Node.js <18. express/compression
has support for older versions, and since it's a widely used package in the ecosystem, I don’t think it’s best to remove support for older versions and not be able to provide the feature that has been awaited for years in that package (Brotli support) in the current major version.
While I agree generally, I’d recommend bumping the major version and minimum node version for compression. It’s not as big a deal as you might expect, since there’s no other breaking changes except node version support, and would allow you to avoid feature flagging brotli support since it only exists around node v12.
Since you aren’t breaking any other features, people can freely upgrade to v2 if they’re using a newer node version. I don’t think it’ll be an issue for people who want brotli support to be using a supported node version.
OK, I just checked out master from this merge commit and released that directly as 0.6.4. Does that work for you?
It's working well, although we need to integrate this option into jshttp/accepts
so we don't have to bring its logic into compression and can use it directly.
Will be used in https://github.com/expressjs/compression/pull/172