hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victor Freire (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1332) Missing content-type MultipartEntity Request
Date Mon, 01 Apr 2013 21:19:17 GMT
Victor Freire created HTTPCLIENT-1332:

             Summary: Missing content-type MultipartEntity Request
                 Key: HTTPCLIENT-1332
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1332
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpMime
    Affects Versions: 4.2.3
         Environment: OS: Windows 7 (Microsoft Windows [Version 6.1.7600])
JDK: jdk1.7.0_13

- httpclient-4.2.3.jar
- httpcore-4.2.2.jar
- httpmime-4.2.3.jar

            Reporter: Victor Freire
            Priority: Blocker

*** Given the following code:

HttpClient httpClient = new DefaultHttpClient();
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("metadata", new StringBody("{ \"number\": 4}", "application/json", Charset.forName("UTF-8")));
HttpPost httpPost = new HttpPost("http://localhost:8080/");

*** The request comes out without the requested content-type ("application/json") and cannot
be interpreted by the application server. There should be a "Content-Type: application/json"
right after Content-Disposition in the request body below.

POST /boards/publish/123/images/an_image_field_key
Host: localhost:8080
Content-type: multipart/form-data; boundary=hRc10UDcwcHyZlNbQwa2NaN-Qq4FxhIq3VHUoKk0
Content-length: 282
Connection: Keep-Alive
User-agent: Apache-HttpClient/4.2.3 (java 1.5)

Content-Disposition: form-data; name="metadata"

{  "number": 4}

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

View raw message