mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-19 16:37:06 +00:00
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 HttpEntity build() {
|
||||
} 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 void testBuildStreamEntity() throws Exception {
|
||||
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…
x
Reference in New Issue
Block a user