Skip to content

Commit 6ce19bb

Browse files
author
Stephane Landelle
committed
Remove RequestBuilderBase.checkIfBodyAllowed, close AsyncHttpClient#455
1 parent 99da52b commit 6ce19bb

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -473,20 +473,12 @@ private void resetMultipartData() {
473473
request.parts = null;
474474
}
475475

476-
private void checkIfBodyAllowed() {
477-
if ("HEAD".equals(request.method)) {
478-
throw new IllegalArgumentException("Can NOT set Body on HTTP Request Method HEAD.");
479-
}
480-
}
481-
482476
public T setBody(File file) {
483-
checkIfBodyAllowed();
484477
request.file = file;
485478
return derived.cast(this);
486479
}
487480

488481
public T setBody(byte[] data) throws IllegalArgumentException {
489-
checkIfBodyAllowed();
490482
resetParameters();
491483
resetNonMultipartData();
492484
resetMultipartData();
@@ -495,7 +487,6 @@ public T setBody(byte[] data) throws IllegalArgumentException {
495487
}
496488

497489
public T setBody(String data) throws IllegalArgumentException {
498-
checkIfBodyAllowed();
499490
resetParameters();
500491
resetNonMultipartData();
501492
resetMultipartData();
@@ -504,7 +495,6 @@ public T setBody(String data) throws IllegalArgumentException {
504495
}
505496

506497
public T setBody(InputStream stream) throws IllegalArgumentException {
507-
checkIfBodyAllowed();
508498
resetParameters();
509499
resetNonMultipartData();
510500
resetMultipartData();
@@ -517,7 +507,6 @@ public T setBody(EntityWriter dataWriter) {
517507
}
518508

519509
public T setBody(EntityWriter dataWriter, long length) throws IllegalArgumentException {
520-
checkIfBodyAllowed();
521510
resetParameters();
522511
resetNonMultipartData();
523512
resetMultipartData();
@@ -527,7 +516,6 @@ public T setBody(EntityWriter dataWriter, long length) throws IllegalArgumentExc
527516
}
528517

529518
public T setBody(BodyGenerator bodyGenerator) {
530-
checkIfBodyAllowed();
531519
request.bodyGenerator = bodyGenerator;
532520
return derived.cast(this);
533521
}

0 commit comments

Comments
 (0)