Skip to content

Commit d673a45

Browse files
author
Stephane Landelle
committed
All HTTP methods allow passing a body, close AsyncHttpClient#421
1 parent 5598901 commit d673a45

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

api/src/main/java/org/asynchttpclient/RequestBuilderBase.java

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

616616
public Request build() {
617-
if ((request.length < 0) && (request.streamData == null) && allowBody(request.getMethod())) {
617+
if (request.length < 0 && request.streamData == null) {
618618
// can't concatenate content-length
619619
String contentLength = null;
620620
if (request.headers != null && request.headers.isEmpty()) {
@@ -635,10 +635,6 @@ public Request build() {
635635
return request;
636636
}
637637

638-
private boolean allowBody(String method) {
639-
return !(method.equalsIgnoreCase("GET") || method.equalsIgnoreCase("OPTIONS") || method.equalsIgnoreCase("TRACE") || method.equalsIgnoreCase("HEAD"));
640-
}
641-
642638
public T addOrReplaceCookie(Cookie cookie) {
643639
String cookieKey = cookie.getName();
644640
boolean replace = false;

0 commit comments

Comments
 (0)