HTTPCLIENT-1605: EntityBuilder sets incorrect content length for entities backed by InputStream
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1655001 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
306334fad7
commit
4a49a41a69
|
@ -317,7 +317,7 @@ public class EntityBuilder {
|
|||
} else if (this.binary != null) {
|
||||
e = new ByteArrayEntity(this.binary, getContentOrDefault(ContentType.DEFAULT_BINARY));
|
||||
} else if (this.stream != null) {
|
||||
e = new InputStreamEntity(this.stream, 1, getContentOrDefault(ContentType.DEFAULT_BINARY));
|
||||
e = new InputStreamEntity(this.stream, -1, getContentOrDefault(ContentType.DEFAULT_BINARY));
|
||||
} else if (this.parameters != null) {
|
||||
e = new UrlEncodedFormEntity(this.parameters,
|
||||
this.contentType != null ? this.contentType.getCharset() : null);
|
||||
|
|
|
@ -71,6 +71,7 @@ public class TestEntityBuilder {
|
|||
Assert.assertNotNull(entity);
|
||||
Assert.assertNotNull(entity.getContent());
|
||||
Assert.assertNotNull(entity.getContentType());
|
||||
Assert.assertEquals(-1, entity.getContentLength());
|
||||
Assert.assertEquals("application/octet-stream", entity.getContentType().getValue());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue