Skip to content

Commit 3014f51

Browse files
author
Stephane Landelle
committed
0 means empty file, not chunked
1 parent e33026d commit 3014f51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

providers/netty/src/main/java/org/asynchttpclient/providers/netty/request/NettyRequestFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ public NettyRequest newNettyRequest(Request request, UriComponents uri, boolean
280280
}
281281

282282
if (body != null) {
283-
if (body.getContentLength() > 0)
284-
httpRequest.headers().set(HttpHeaders.Names.CONTENT_LENGTH, body.getContentLength());
285-
else
283+
if (body.getContentLength() < 0)
286284
httpRequest.headers().set(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
285+
else
286+
httpRequest.headers().set(HttpHeaders.Names.CONTENT_LENGTH, body.getContentLength());
287287

288288
if (body.getContentType() != null)
289289
httpRequest.headers().set(HttpHeaders.Names.CONTENT_TYPE, body.getContentType());

0 commit comments

Comments
 (0)