Skip to content

Commit

Permalink
java apache-httpclient serialize support custom contentType
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeCqupt committed Aug 3, 2022
1 parent e9599d9 commit 56ccfff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
for (Entry<String, Object> paramEntry : formParams.entrySet()) {
formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue())));
}
try {
return new UrlEncodedFormEntity(formValues);
} catch (UnsupportedEncodingException e) {
throw new ApiException(e);
}
return new UrlEncodedFormEntity(formValues, contentType.getCharset());
} else {
// Handle files with unknown content type
if (obj instanceof File) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,7 @@ public HttpEntity serialize(Object obj, Map<String, Object> formParams, ContentT
for (Entry<String, Object> paramEntry : formParams.entrySet()) {
formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue())));
}
try {
return new UrlEncodedFormEntity(formValues);
} catch (UnsupportedEncodingException e) {
throw new ApiException(e);
}
return new UrlEncodedFormEntity(formValues, contentType.getCharset());
} else {
// Handle files with unknown content type
if (obj instanceof File) {
Expand Down

0 comments on commit 56ccfff

Please sign in to comment.