[
https://issues.apache.org/jira/browse/HTTPCLIENT-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oleg Kalnichevski resolved HTTPCLIENT-1332.
-------------------------------------------
Resolution: Invalid
> MultipartEntity entity = new
> MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
Use strict mode instead of browser compatibility.
Oleg
> 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
> Libs:
> - httpclient-4.2.3.jar
> - httpcore-4.2.2.jar
> - httpmime-4.2.3.jar
> Reporter: Victor Freire
> Priority: Blocker
> Labels: content-type, multipart, multipart/form-data
>
> *** 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/");
> httpPost.setEntity(entity);
> httpClient.execute(httpPost);
> *** 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)
> --hRc10UDcwcHyZlNbQwa2NaN-Qq4FxhIq3VHUoKk0
> Content-Disposition: form-data; name="metadata"
> { "number": 4}
> --hRc10UDcwcHyZlNbQwa2NaN-Qq4FxhIq3VHUoKk0--
--
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: [email protected]
For additional commands, e-mail: [email protected]