CodecHttpMessageConverter supports a default charset
This commit is contained in:
parent
67175005e3
commit
cbe2cbcc88
|
|
@ -144,6 +144,12 @@ public class CodecHttpMessageConverter<T> implements HttpMessageConverter<T> {
|
||||||
contentTypeToUse = (mediaType != null ? mediaType : contentTypeToUse);
|
contentTypeToUse = (mediaType != null ? mediaType : contentTypeToUse);
|
||||||
}
|
}
|
||||||
if (contentTypeToUse != null) {
|
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);
|
headers.setContentType(contentTypeToUse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue