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-1501) Fluent API not accepting form parameters
Date Fri, 25 Apr 2014 08:35:14 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-1501.
-------------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.4 Alpha1
                   4.3.4

It is a duplicate of HTTPCLIENT-1474. 

To work the issue around you can downgrade HC fluent module to 4.3.2.

Oleg 

> Fluent API not accepting form parameters
> ----------------------------------------
>
>                 Key: HTTPCLIENT-1501
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1501
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Fluent HC
>    Affects Versions: 4.3.3
>            Reporter: Remis
>             Fix For: 4.3.4, 4.4 Alpha1
>
>
> I just tried to run the example from [http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fluent.html]:
> {code:title=Test.java}
> public static void main(final String[] args) throws Exception {
> // Execute a POST with a custom header through the proxy containing a request body
> // as an HTML form and save the result to the file
> Request.Post("http://somehost/some-form")
>         .addHeader("X-Custom-header", "stuff")
>         .viaProxy(new HttpHost("myproxy", 8080))
>         .bodyForm(Form.form().add("username", "vip").add("password", "secret").build())
>         .execute().saveContent(new File("result.dump"));
> }{code}
> and I got an unexpected error (I was expecting a connection error, but it seems that
HttpClient failed before the request was sent):
> {code}
> Exception in thread "main" java.lang.IllegalStateException: POST request cannot enclose
an entity
> 	at org.apache.http.client.fluent.Request.body(Request.java:299)
> 	at org.apache.http.client.fluent.Request.bodyString(Request.java:331)
> 	at org.apache.http.client.fluent.Request.bodyForm(Request.java:312)
> 	at org.apache.http.client.fluent.Request.bodyForm(Request.java:316)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message