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

Configurable compression of content-types. #51

Closed jacobstr closed 7 years ago

jacobstr commented 7 years ago

Along for the ride are functional options to stop the combinatorial growth of option-specific factories.

jacobstr commented 7 years ago

See also: #40 and #43

jacobstr commented 7 years ago

Cheers for the quick review. Stylistic nits were quite sensible. Option type was also made private.

jacobstr commented 7 years ago

There's a slight caveat on what to do if the Content-Type is empty and cannot be determined. Right now you could make it work by passing []string{""}.

[]string{} - Match any content type (backwards compatible, default)
[]string{"","application/json"} - Match unknown content types and application/json.

That's kind of incidental to how the comparsion works given the value coming out of Header().Get("Content-Type").

jprobinson commented 7 years ago

🐈 thanks!!