http icon indicating copy to clipboard operation
http copied to clipboard

Encoding is messed up with AutoInflate

Open ixti opened this issue 6 years ago • 0 comments

When requesting a resource with auto_inflate feature on, encoding of body most certainly will be messed up.

To reproduce:

HTTP.use(:auto_inflate).headers("Accept-Encoding" => "gzip").get(url)

url in the above is some URL that returns response with headers like this:

Content-Type: application/json; charset=utf-8
Content-Encoding: gzip

in this example, encoding of the body will be Encoding::BINARY. Even worse, if you pass :encoding => Encoding::UTF_8 explicitly when calling #get it won't be respected at the end.

ixti avatar Feb 27 '19 23:02 ixti