hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Choma (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1754) HttpPost return a empty body
Date Fri, 08 Jul 2016 12:41:10 GMT
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message