1
0
Fork 0

Merge pull request #202 from jaimefreire/master

Closing streams and consuming the entities so pools can reuse connect…
master
Bob Carroll 2017-07-02 12:26:27 -07:00 committed by GitHub
commit c7f67d81bf
1 changed files with 9 additions and 1 deletions

View File

@ -52,6 +52,7 @@ import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.InputStreamBody;
import org.apache.http.util.EntityUtils;
/**
* A simple REST client that speaks JSON.
@ -153,9 +154,16 @@ public class RestClient {
BufferedReader br = new BufferedReader(isr);
String line = "";
while ((line = br.readLine()) != null)
while ((line = br.readLine()) != null) {
result.append(line);
}
isr.close();
br.close();
isr=null;
br=null;
}
EntityUtils.consumeQuietly(ent);
StatusLine sl = resp.getStatusLine();