提交 cbe2cbcc 编写于 作者: R Rossen Stoyanchev

CodecHttpMessageConverter supports a default charset

上级 67175005
......@@ -144,6 +144,12 @@ public class CodecHttpMessageConverter<T> implements HttpMessageConverter<T> {
contentTypeToUse = (mediaType != null ? mediaType : contentTypeToUse);
}
if (contentTypeToUse != null) {
if (contentTypeToUse.getCharset() == null) {
MediaType mediaType = getDefaultContentType(type);
if (mediaType != null && mediaType.getCharset() != null) {
contentTypeToUse = new MediaType(contentTypeToUse, mediaType.getCharset());
}
}
headers.setContentType(contentTypeToUse);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册