Skip to content

Commit

Permalink
Use charset of request to create the String content.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuhtz committed Jan 29, 2022
1 parent 057caad commit 2d5aa16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hc5/src/main/java/feign/hc5/ApacheHttp5Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ ClassicHttpRequest toClassicHttpRequest(Request request, Request.Options options
entity = new ByteArrayEntity(data, null);
} else {
final ContentType contentType = getContentType(request);
entity = new StringEntity(new String(data), contentType);
if (request.charset() != null) {
String content = new String(request.body(), request.charset());
entity = new StringEntity(content, contentType);
} else {
entity = new StringEntity(new String(data), contentType);
}
}

requestBuilder.setEntity(entity);
Expand Down

0 comments on commit 2d5aa16

Please sign in to comment.