http
http copied to clipboard
Encoding is messed up with AutoInflate
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.