Skip to content

Commit

Permalink
Use charset of request to create the String content. (#1571)
Browse files Browse the repository at this point in the history
Co-authored-by: Marvin Froeder <[email protected]>
  • Loading branch information
akuhtz and velo authored Mar 2, 2022
1 parent 385aa66 commit 38ccd6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 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,13 @@ 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);
String content;
if (request.charset() != null) {
content = new String(data, request.charset());
} else {
content = new String(data);
}
entity = new StringEntity(content, contentType);
}

requestBuilder.setEntity(entity);
Expand Down

0 comments on commit 38ccd6f

Please sign in to comment.