Skip to content

Commit a35881e

Browse files
author
Stephane Landelle
committed
All HTTP methods allow passing a body, backport AsyncHttpClient#421
1 parent b92a155 commit a35881e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/main/java/com/ning/http/client/RequestBuilderBase.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ public T setConnectionPoolKeyStrategy(ConnectionPoolKeyStrategy connectionPoolKe
624624
}
625625

626626
public Request build() {
627-
if ((request.length < 0) && (request.streamData == null) && allowBody(request.getMethod())) {
627+
if (request.length < 0 && request.streamData == null) {
628628
// can't concatenate content-length
629629
String contentLength = request.headers.getFirstValue("Content-Length");
630630

@@ -639,10 +639,6 @@ public Request build() {
639639
return request;
640640
}
641641

642-
private boolean allowBody(String method) {
643-
return !(method.equalsIgnoreCase("GET") || method.equalsIgnoreCase("OPTIONS") || method.equalsIgnoreCase("TRACE") || method.equalsIgnoreCase("HEAD"));
644-
}
645-
646642
public T addOrReplaceCookie(Cookie cookie) {
647643
String cookieKey = cookie.getName();
648644
boolean replace = false;

0 commit comments

Comments
 (0)