Deprecate MediaType.APPLICATION_JSON_UTF8

This commit deprecates MediaType.APPLICATION_JSON_UTF8 and
MediaType.APPLICATION_PROBLEM_JSON_UTF8 in favor of
MediaType.APPLICATION_JSON and MediaType.APPLICATION_PROBLEM_JSON since
UTF-8 encoding is now handled correctly by most browsers
(related bug has been fixed in Chrome since September 2017).

MediaType.APPLICATION_JSON is now used as the default JSON content type.

Closes gh-22788
This commit is contained in:
Sebastien Deleuze
2019-04-30 16:05:09 +02:00
parent 2e6059f6b0
commit 89454e69c3
39 changed files with 144 additions and 147 deletions

View File

@@ -48,7 +48,7 @@ public class MappingJackson2MessageConverterTests {
public void defaultConstructor() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
assertThat(converter.getSupportedMimeTypes(),
contains(new MimeType("application", "json", StandardCharsets.UTF_8)));
contains(new MimeType("application", "json")));
assertFalse(converter.getObjectMapper().getDeserializationConfig()
.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
}
@@ -183,7 +183,7 @@ public class MappingJackson2MessageConverterTests {
assertTrue(actual.contains("\"array\":[\"Foo\",\"Bar\"]"));
assertTrue(actual.contains("\"bool\":true"));
assertTrue(actual.contains("\"bytes\":\"AQI=\""));
assertEquals("Invalid content-type", new MimeType("application", "json", StandardCharsets.UTF_8),
assertEquals("Invalid content-type", new MimeType("application", "json"),
message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MimeType.class));
}