Skip to content

Commit 87d64d2

Browse files
author
Stephane Landelle
committed
Remove RequestBuilderBase.checkIfBodyAllowed, close AsyncHttpClient#455
1 parent 506524f commit 87d64d2

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -479,20 +479,12 @@ private void resetMultipartData() {
479479
request.parts = null;
480480
}
481481

482-
private void checkIfBodyAllowed() {
483-
if ("HEAD".equals(request.method)) {
484-
throw new IllegalArgumentException("Can NOT set Body on HTTP Request Method HEAD.");
485-
}
486-
}
487-
488482
public T setBody(File file) {
489-
checkIfBodyAllowed();
490483
request.file = file;
491484
return derived.cast(this);
492485
}
493486

494487
public T setBody(byte[] data) throws IllegalArgumentException {
495-
checkIfBodyAllowed();
496488
resetParameters();
497489
resetNonMultipartData();
498490
resetMultipartData();
@@ -501,7 +493,6 @@ public T setBody(byte[] data) throws IllegalArgumentException {
501493
}
502494

503495
public T setBody(String data) throws IllegalArgumentException {
504-
checkIfBodyAllowed();
505496
resetParameters();
506497
resetNonMultipartData();
507498
resetMultipartData();
@@ -510,7 +501,6 @@ public T setBody(String data) throws IllegalArgumentException {
510501
}
511502

512503
public T setBody(InputStream stream) throws IllegalArgumentException {
513-
checkIfBodyAllowed();
514504
resetParameters();
515505
resetNonMultipartData();
516506
resetMultipartData();
@@ -519,7 +509,6 @@ public T setBody(InputStream stream) throws IllegalArgumentException {
519509
}
520510

521511
public T setBody(BodyGenerator bodyGenerator) {
522-
checkIfBodyAllowed();
523512
request.bodyGenerator = bodyGenerator;
524513
return derived.cast(this);
525514
}

0 commit comments

Comments
 (0)