@@ -494,10 +494,9 @@ private void checkFileBody(BoundRequestBuilder builder) {
494
494
}
495
495
}
496
496
try {
497
- byte [] bodyBytes = sb .toString ().getBytes ( this .encoding );
498
- InputStream bodyInStream = new ByteArrayInputStream ( bodyBytes );
499
- builder .setBody ( bodyInStream );
500
- } catch ( UnsupportedEncodingException e ) {
497
+ byte [] bodyBytes = sb .toString ().getBytes (this .encoding );
498
+ builder .setBody (bodyBytes );
499
+ } catch (UnsupportedEncodingException e ) {
501
500
throw new RuntimeException (e );
502
501
}
503
502
@@ -525,14 +524,13 @@ private void checkFileBody(BoundRequestBuilder builder) {
525
524
if (this .parameters != null && !this .parameters .isEmpty ()) {
526
525
throw new RuntimeException ("POST or PUT method with parameters AND body are not supported." );
527
526
}
528
- if (this .body instanceof InputStream ) {
527
+ if (this .body instanceof InputStream ) {
529
528
builder .setBody ((InputStream )this .body );
530
529
} else {
531
530
try {
532
- byte [] bodyBytes = this .body .toString ().getBytes ( this .encoding );
533
- InputStream bodyInStream = new ByteArrayInputStream ( bodyBytes );
534
- builder .setBody ( bodyInStream );
535
- } catch ( UnsupportedEncodingException e ) {
531
+ byte [] bodyBytes = this .body .toString ().getBytes (this .encoding );
532
+ builder .setBody (bodyBytes );
533
+ } catch (UnsupportedEncodingException e ) {
536
534
throw new RuntimeException (e );
537
535
}
538
536
}
0 commit comments