Content-Encoding Header omitted
See original GitHub issueThe header is omitted here (returns empty list)
Unirest.get("https://google.de/").header("Accept-Encoding", "gzip").asString().headers.get("Content-Encoding")
The following prints nothing (header also omitted)
Unirest.get("https://google.de/").header("Accept-Encoding", "gzip").thenConsume {
println(it.encoding)
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Content-Encoding HTTP Header removed from response by ...
In the response Backend Application is sending Header "Content-Encoding" to DataPower (confirmed by doing packet capture), but when the response reaches the ...
Read more >Missing content-encoding in Response Header for Request ...
Hi @BarryPollard, thanks for the response. it appears the compression is happening on the Apache side since hitting the portal servers directly ...
Read more >Content-Encoding Header NOT omitted #299 - GitHub
Unirest automatically deflates gzipped responses but does not remove the content-encoding header to reflect that the response is no longer ...
Read more >Missing Content-Encoding header - Google Groups
304 the "Content-Encoding" is missing. Perhaps the missing header is correct when the (uncompressed) response comes from the cache?
Read more >Accept-Encoding - HTTP - MDN Web Docs
The Accept-Encoding request HTTP header indicates the content encoding (usually a compression algorithm) that the client can understand.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was able to confirm that this is expected behavior. Apache Http Client removes the content-encoding because it deflates the entity so it is no longer gziped. There are several tests to this effect in the Apache project.
This is not the case with the async client where apache doesn’t automatically decompress the body. In this case Unirest does the decompression but it doesn’t remove the header. I’m going to switch this issue to track removing the encoding in that case to match the behavior of synchronous client.
switched and opened a new issue https://github.com/Kong/unirest-java/issues/299