We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 96c2e8f commit ce14fffCopy full SHA for ce14fff
unirest/src/main/java/kong/unirest/apache/ApacheResponse.java
@@ -81,10 +81,12 @@ public byte[] getContentAsBytes() {
81
}
82
try {
83
InputStream is = getContent();
84
- if (isGzipped(getEncoding())) {
85
- is = new GZIPInputStream(getContent());
+ byte[] bytes = getBytes(is);
+ if (bytes.length > 0 && isGzipped(getEncoding())) {
86
+ is = new GZIPInputStream(new ByteArrayInputStream(bytes));
87
+ return getBytes(is);
88
- return getBytes(is);
89
+ return bytes;
90
} catch (IOException e2) {
91
throw new UnirestException(e2);
92
} finally {
0 commit comments