Skip to content

Commit 4437cd6

Browse files
lochstarmanoldonev
authored andcommitted
fix(android): ignore gzip content-encoding for 204 statusCode (#7417)
1 parent 4353450 commit 4437cd6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets

tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/Async.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ public void readResponseStream(HttpURLConnection connection, Stack<Closeable> op
409409

410410
// In the event we don't have a null stream, and we have gzip as part of the encoding
411411
// then we will use gzip to decode the stream
412+
// Ignore gzip encoding for 204 'No Content' status to prevent java.io.EOFException
412413
String encodingHeader = connection.getHeaderField("Content-Encoding");
413-
if (encodingHeader != null && encodingHeader.toLowerCase().contains("gzip")) {
414+
if (encodingHeader != null && encodingHeader.toLowerCase().contains("gzip") && this.statusCode != 204) {
414415
inStream = new GZIPInputStream(inStream);
415416
}
416417

@@ -584,4 +585,4 @@ private void closeOpenedStreams(Stack<Closeable> streams) throws IOException {
584585
}
585586
}
586587
}
587-
}
588+
}

0 commit comments

Comments
 (0)