hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCLIENT-1754) HttpPost return a empty body
Date Fri, 08 Jul 2016 15:25:11 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski resolved HTTPCLIENT-1754.
-------------------------------------------
    Resolution: Invalid

Use logging to find out
http://hc.apache.org/httpcomponents-client-4.5.x/logging.html

Oleg

> 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