question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content-Encoding Header omitted

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
rybercommented, Sep 21, 2019

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.

0reactions
rybercommented, Sep 21, 2019

switched and opened a new issue https://github.com/Kong/unirest-java/issues/299

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found