Nice and simple! :) Gary
On Wed, Mar 16, 2022, 05:01 <ol...@apache.org> wrote: > This is an automated email from the ASF dual-hosted git repository. > > olegk pushed a commit to branch master > in repository > https://gitbox.apache.org/repos/asf/httpcomponents-client.git > > > The following commit(s) were added to refs/heads/master by this push: > new 5f9bc34 StringBody: just write the bytes to the output stream > 5f9bc34 is described below > > commit 5f9bc347ee6a2191b2ad10eb2e0ed4c19d35f83d > Author: John Gallagher <jgallag...@slack-corp.com> > AuthorDate: Tue Mar 15 16:38:52 2022 -0400 > > StringBody: just write the bytes to the output stream > --- > .../java/org/apache/hc/client5/http/entity/mime/StringBody.java | 9 > +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git > a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/StringBody.java > b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/StringBody.java > index 2432951..341526c 100644 > --- > a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/StringBody.java > +++ > b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/StringBody.java > @@ -29,7 +29,6 @@ package org.apache.hc.client5.http.entity.mime; > > import java.io.ByteArrayInputStream; > import java.io.IOException; > -import java.io.InputStream; > import java.io.InputStreamReader; > import java.io.OutputStream; > import java.io.Reader; > @@ -70,13 +69,7 @@ public class StringBody extends AbstractContentBody { > @Override > public void writeTo(final OutputStream out) throws IOException { > Args.notNull(out, "Output stream"); > - final InputStream in = new ByteArrayInputStream(this.content); > - final byte[] tmp = new byte[4096]; > - int l; > - while ((l = in.read(tmp)) != -1) { > - out.write(tmp, 0, l); > - } > - out.flush(); > + out.write(this.content); > } > > @Override >