Martin Choma created HTTPCLIENT-1754:
----------------------------------------
Summary: HttpPost return a empty body
Key: HTTPCLIENT-1754
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1754
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpClient
Affects Versions: 4.5
Reporter: Martin Choma
I have the code below, and my problem is that the response.status is 200 (is
ok) and my response body is empty and it should return a json response. Is the
problem the length maybe?:`
{code:java}
HttpPost post = new HttpPost("http://localhost:8080/rest/login");
httpClient = HttpClients.createDefault();
List<NameValuePair> formParams = new ArrayList<NameValuePair>();
NameValuePair pair = new BasicNameValuePair("token",token);
formParams.add(pair);
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams);
post.setEntity(entity);
HttpResponse response = httpClient.execute(post);
this.code = response.getStatusLine().getStatusCode();
InputStream body = response.getEntity().getContent();
BufferedReader rd = new BufferedReader(new
InputStreamReader(response.getEntity().getContent()));
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]