inflation
inflation copied to clipboard
Support Brotli decompression (content-encoding: br)
Adds backwards-compatible support for Brotli decompression for versions of Node that natively support Brotli (10.16.0+). For reference, Node LTS is soon to be 14.15.0+ only.
If the version of Node doesn't support Brotli and the request specifies content-encoding: br
, an HTTP 415 error is thrown, the exact same as before. If Node does support Brotli, it will use Brotli decompression on the provided stream.
A new option called options.brotli
is supported. This way Brotli and Gzip options are kept separate. Only the brotli
options are passed to the Brotli decompressor.
Added unit tests for both new and old versions of Node. Added Node 16 to the Travis CI matrix. Tested with Node 8 to ensure we get a 415 status code when Brotli is unsupported and tested with Node 16 to ensure Brotli decompression works when it is supported.
@jonathanong would you be open to reviewing this if you have some time? I know it's been six years since you last worked on this package. I tried to write the code in a way that wouldn't require attention for another six. The motivation for this change is to bring Brotli decompression to koa-body and koa-bodyparser, both of which depend on inflation@^2.0.0 via co-body.
@fengmk2 any chance you can merge and version this?
@xdumaine Sure, I will merge and release a minor version.
@dougwilson @jonathanong add me to the npm owner?
@fengmk2 I should be able to, though jonathan has been mainly maintaining this pkg so want to give him time to say something before I do. Ping me again if we don't hear from him and I'll add ya
2.1.0 Released