You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by rmillet <rm...@gmail.com> on 2012/05/31 10:48:32 UTC
DecompressingHttpClient and POST requests
Hi,
I want to replace the deprecated ContentEncodingHttpClient with
DecompressingHttpClient, but the DecompressingHttpClient don't send the
body of the Post request.
(If I use the DefaultHttpClient without the DecompressingHttpClient, the
request sent contains the body and the Content-Type header)
Here is what I do:
HttpClient client = new DecompressingHttpClient(new
DefaultHttpClient());
HttpPost request = new HttpPost(new URI("http://tests/post.php
"));
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("toto", "42"));
request.setEntity(new UrlEncodedFormEntity(parameters,
Consts.UTF_8));
client.execute(request);
What is the working fashion to send post requests with
DecompressingHttpClient ?
Regards,
rmillet
Re: DecompressingHttpClient and POST requests
Posted by Jon Moore <jo...@apache.org>.
Hi rmillet,
You've run into a bug that someone else just reported in JIRA:
https://issues.apache.org/jira/browse/HTTPCLIENT-1199
We'll work on getting a fix into the next release.
Jon
On Thu, May 31, 2012 at 4:48 AM, rmillet <rm...@gmail.com> wrote:
> Hi,
>
> I want to replace the deprecated ContentEncodingHttpClient with
> DecompressingHttpClient, but the DecompressingHttpClient don't send the
> body of the Post request.
> (If I use the DefaultHttpClient without the DecompressingHttpClient, the
> request sent contains the body and the Content-Type header)
>
>
> Here is what I do:
>
> HttpClient client = new DecompressingHttpClient(new
> DefaultHttpClient());
>
> HttpPost request = new HttpPost(new URI("http://tests/post.php
> "));
> List<NameValuePair> parameters = new ArrayList<NameValuePair>();
> parameters.add(new BasicNameValuePair("toto", "42"));
> request.setEntity(new UrlEncodedFormEntity(parameters,
> Consts.UTF_8));
>
> client.execute(request);
>
>
> What is the working fashion to send post requests with
> DecompressingHttpClient ?
>
>
> Regards,
> rmillet
>