Httpx: Handle HEAD responses with Brotli decoder

Created on 19 Aug 2019  路  2Comments  路  Source: encode/httpx

Currently if you receive a response with Content-Encoding: br set and no body we get an error because Brotli doesn't like being called on an empty stream.

bug good first issue

Most helpful comment

On reviewing #237 I think we should just call into the decoders, but that we should just make sure that all the decoder implementations correctly handle b"" input, and all correctly return b"" outputs in that case.

Ideally a test case for this issue would be parameterized to ensure correct behavior here from all our decoder classes.

All 2 comments

More generally: we should make sure not to call any decoder if the body is empty.

On reviewing #237 I think we should just call into the decoders, but that we should just make sure that all the decoder implementations correctly handle b"" input, and all correctly return b"" outputs in that case.

Ideally a test case for this issue would be parameterized to ensure correct behavior here from all our decoder classes.

Was this page helpful?
0 / 5 - 0 ratings