mirror of
https://github.com/square/okhttp.git
synced 2025-11-29 06:23:09 +03:00
Added check for length < 0 for transparent gzip response.
The documentation for org.apache.http.HttpEntity::getContentLength() states that a negative number will be returned when the length of the content is not known.
This commit is contained in:
@@ -236,8 +236,7 @@ public class OkApacheClientTest {
|
|||||||
// content length should also be absent
|
// content length should also be absent
|
||||||
Header[] headers1b = response1.getHeaders("Content-Length");
|
Header[] headers1b = response1.getHeaders("Content-Length");
|
||||||
assertEquals(0, headers1b.length);
|
assertEquals(0, headers1b.length);
|
||||||
// The following currently fails because ContentLength(-1) is returned from the entity
|
assertTrue(response1.getEntity().getContentLength() < 0);
|
||||||
// assertNull(response1.getEntity().getContentLength());
|
|
||||||
Header[] headers1c = response1.getHeaders("Content-Type");
|
Header[] headers1c = response1.getHeaders("Content-Type");
|
||||||
assertEquals(1, headers1c.length);
|
assertEquals(1, headers1c.length);
|
||||||
assertEquals("application/json", headers1c[0].getValue());
|
assertEquals("application/json", headers1c[0].getValue());
|
||||||
|
|||||||
Reference in New Issue
Block a user