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

Support asterisk in accept-encoding header #7

Merged

Conversation

SerayaEryn
Copy link
Contributor

This PR adds support for an asterisk * in the accept-encoding header.

@@ -155,6 +155,9 @@ function getEncodingHeader (request) {
if (supportedEncodings.indexOf(acceptEncodings[i]) > -1) {
return acceptEncodings[i]
}
if (acceptEncodings[i].indexOf('*') > -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be faster.
If a user puts * as accepted encodings, there will not be other stuff there.
if so, we can just check it the header value is equal to *.

Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we cannot do that. Something like 'gzip;q=1.0, *;q=0.5' is valid and might occur. This would mean use gzip if possible and else use any other encoding.

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@delvedor delvedor merged commit e6df380 into fastify:master Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants