-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
accept-encoding can contain whitespace #26
accept-encoding can contain whitespace #26
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
index.js
Outdated
@@ -132,10 +132,10 @@ function getEncodingHeader (request) { | |||
if (!header) return undefined | |||
var acceptEncodings = header.split(',') | |||
for (var i = 0; i < acceptEncodings.length; i++) { | |||
if (supportedEncodings.indexOf(acceptEncodings[i]) > -1) { | |||
return acceptEncodings[i] | |||
if (supportedEncodings.indexOf(acceptEncodings[i].trim()) > -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you cache the value?
var acceptEncoding = acceptEncodings[i].trim()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can you resolve the conflicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This will allow whitepsaces in accept-encoding headers.
While working on #25 I discovered that accept headers with whitespace did not work.
Taken from a real request in the wild
accept-encoding: "br, gzip, deflate"