fix(android): ignore gzip content-encoding for 204 statusCode (#7417)

This commit is contained in:
Lochlan
2019-06-28 20:41:44 +10:00
committed by Manol Donev
parent 43534502f9
commit 4437cd622b

View File

@@ -409,8 +409,9 @@ public class Async {
// In the event we don't have a null stream, and we have gzip as part of the encoding
// then we will use gzip to decode the stream
// Ignore gzip encoding for 204 'No Content' status to prevent java.io.EOFException
String encodingHeader = connection.getHeaderField("Content-Encoding");
if (encodingHeader != null && encodingHeader.toLowerCase().contains("gzip")) {
if (encodingHeader != null && encodingHeader.toLowerCase().contains("gzip") && this.statusCode != 204) {
inStream = new GZIPInputStream(inStream);
}