Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option preferred encodings array #59

Merged
merged 2 commits into from
Aug 31, 2024

Conversation

danielgindi
Copy link
Contributor

Will be used in expressjs/compression#172

@danielgindi
Copy link
Contributor Author

@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.

@nicksrandall
Copy link

@dougwilson thanks for shepherding this along.

@wesleytodd wesleytodd merged commit 8f58d74 into jshttp:1.x Aug 31, 2024
8 checks passed
@wesleytodd
Copy link
Member

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.

@bjohansebas
Copy link
Member

@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

@blakeembrey
Copy link
Member

@bjohansebas any reason compression can’t be bumped to 1.0 and do its own major release for the feature?

@bjohansebas
Copy link
Member

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.

@blakeembrey
Copy link
Member

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.

@blakeembrey
Copy link
Member

OK, I just checked out master from this merge commit and released that directly as 0.6.4. Does that work for you?

@bjohansebas
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants