Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Invalid
-
5.2.1
-
None
-
None
Description
We are doing upgrade from httpclient (4.5.13) to httpclient5 (5.2.1).
And after the upgrade, we found when use following sample code to create a post request, the request execution will fail with 400 Bad Request error, because the character "~" in parameter string is not encoded into %7E. If we set the charset for UrlEncodedFormEntity to UTF-8, still hit same issue.
HttpPost request = new HttpPost(strUrl); List<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("name", "a~b")); HttpEntity postParams = new UrlEncodedFormEntity(parameters); request.setEntity(postParams);
While the encoding was working correctly with httpclient (4.5.13).