Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Invalid
-
4.2.3
-
None
-
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
Description
-
-
- Given the following code:
-
HttpClient httpClient = new DefaultHttpClient();
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("metadata", new StringBody("
", "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"
-hRc10UDcwcHyZlNbQwa2NaN-Qq4FxhIq3VHUoKk0-