How to deal with "java.util.zip.ZipException: Not in GZIP format" exception while processing request #427
-
Hello! I receive "com.mashape.unirest.http.exceptions.UnirestException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.zip.ZipException: Not in GZIP format " exception when processing request (request.asString() and request.asBinary() ), however I did not see any exception while using curl. It seems, there is something wrong within response header which causes the exception. According to some hints in website (https://stackoverflow.com/questions/13018732/java-util-zip-zipexception-not-in-gzip-format), we could reset header property to solve this issue. My question is, how to reset this using unirest? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
So a few things,
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
You can get ahold of the raw Apache InputStream when using the Unirest.get(path).thenConsume(raw -> {
InputStream i = raw.getContent();
}); once you have read the InputStream it can't be read again, which is why this method is a consumer. |
Beta Was this translation helpful? Give feedback.
You can get ahold of the raw Apache InputStream when using the
thenConsume
method. This is before Unirest has read it, so it's the raw socket.once you have read the InputStream it can't be read again, which is why this method is a consumer.
Your real problem is that the API is reporting the content is gzipped but it's not. Have you reported this to the API owner?