This change makes it so the gzipped library respects quality values when clients send them. Clients would now get a gzipped file rather than brotli encoded file (if possible) if they sent a header like:
Accept-Encoding: gzip;q=1, br;q=0.7
The other nice thing about this change is that header.ParseAccept() now only needs to be called one time; previously it was called twice, once for each encoding (brotli and gzip).
It should also now be a lot fewer lines of code to add new encodings support to this library. I considered adding deflate, but deflate is super old/deprecated and I don't know of any clients supporting deflate but not gzip, so I didn't see the point.
I added some new tests, and made the previous gzip tests table driven.
Thanks very much! Ironically I have a library for handling content negotiation headers which I haven't released yet, but it makes sense to handle the Accept-Encoding header without an external dependency.
This change makes it so the gzipped library respects quality values when clients send them. Clients would now get a gzipped file rather than brotli encoded file (if possible) if they sent a header like:
The other nice thing about this change is that
header.ParseAccept()
now only needs to be called one time; previously it was called twice, once for each encoding (brotli and gzip).It should also now be a lot fewer lines of code to add new encodings support to this library. I considered adding deflate, but deflate is super old/deprecated and I don't know of any clients supporting deflate but not gzip, so I didn't see the point.
I added some new tests, and made the previous gzip tests table driven.