Skip to content

Commit

Permalink
fix(java): apache-httpclient serialization error
Browse files Browse the repository at this point in the history
fixes following related issue:
OpenAPITools#12797
  • Loading branch information
renal31 committed Dec 13, 2023
1 parent b7f31dd commit 6dc9a20
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import java.io.InputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
Expand Down Expand Up @@ -785,7 +786,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
String mimeType = contentType.getMimeType();
if (isJsonMime(mimeType)) {
try {
return new StringEntity(objectMapper.writeValueAsString(obj), contentType);
return new StringEntity(objectMapper.writeValueAsString(obj), contentType.withCharset(StandardCharsets.UTF_8));
} catch (JsonProcessingException e) {
throw new ApiException(e);
}
Expand Down

0 comments on commit 6dc9a20

Please sign in to comment.