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
feat: support brotli #150
base: master
Are you sure you want to change the base?
feat: support brotli #150
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.
Thank you so much for volunteering to help get this feature a reality! From reviewing the PR, it looks like the following things still need to be done, so I'm listing so you have something concrete to work through:
(1) There is no documentation around this, specifically all the options like chunkSize
, level
, memLebel
, stragety
, windowBits
, etc. are all using zlib
constants and not the Brotli constants. I have not actually looked hard yet, but I assume these constants are not the right ones for Brotli (since the Node.js doc lists different constants) but at worse since all these constants are just integers, setting one of these options may break when br
is accepted by the client, since they are going to be passed into createBrotliDecompress
with this PR (this needs to be validated / tested).
(2) There are no tests added. This is picked up just by the coverage CI check, since the new line for br
in the switch statement is not getting triggered, but there should be at least all the equiv tests for br
that there are for the others.
I hope this helps! Thanks for picking this up!
@dougwilson Thank you so much for the quick and detailed review. For the
For the test, since brotli is only supported in node 11.7, can we add it in travis ? |
This comment has been minimized.
This comment has been minimized.
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.
Thanks for working on this @clarkdo!
For what it's worth, in my testing the content negotiation provided by accepts (which uses negotiator under the hood) will choose gzip
over br
for most popular browsers. There's an issue tracking that behavior here: jshttp/negotiator#49
Working off of your branch I was able to get Brotli working end-to-end by swapping out the content negotiation from "accepts" to "accept": https://www.npmjs.com/package/accept, and fixing a couple typos.
I'm happy to contribute those changes if we want to prefer br
over gzip
. The changelist is visible here: deal#1
No description provided.