nytimes / gziphandler

Go middleware to gzip HTTP responses
https://godoc.org/github.com/NYTimes/gziphandler
Apache License 2.0
868 stars 129 forks source link

Add support to skiping gzip for small responses. Fixes #24 #30

Closed alexandrestein closed 7 years ago

alexandrestein commented 7 years ago

This make possible to skip compression if the response is smaller than the specified size.

jprobinson commented 7 years ago

🎉 🌮 !

alexandrestein commented 7 years ago

I hope it will helps.

aravindc26 commented 7 years ago

The w.WriteHeader() call sets "Content-Encoding: gzip" by default, even though the subsequent call to w.Write() is not gzip encoded.

adammck commented 7 years ago

@aravindc26 is correct. The test covers the case when WriteHeader is called implicitly by Write (because it returns early, so skips the call to init, which sets the encoding header), but not when it's called directly. Sorry that I missed this when reviewing. @alexandreStein, please feel free to resubmit with a fix, or one of us can patch it up later. Reverting.