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:
@@ -692,7 +692,7 @@ public class RequestResponseBodyMethodProcessorTests {
|
||||
@Test // SPR-14520
|
||||
public void resolveArgumentTypeVariableWithGenericInterface() throws Exception {
|
||||
this.servletRequest.setContent("\"foo\"".getBytes("UTF-8"));
|
||||
this.servletRequest.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||
this.servletRequest.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||
|
||||
Method method = MyControllerImplementingInterface.class.getMethod("handle", Object.class);
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new MyControllerImplementingInterface(), method);
|
||||
|
||||
@@ -1205,7 +1205,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
|
||||
response = new MockHttpServletResponse();
|
||||
getServlet().service(request, response);
|
||||
assertEquals(500, response.getStatus());
|
||||
assertEquals("application/problem+json;charset=UTF-8", response.getContentType());
|
||||
assertEquals("application/problem+json", response.getContentType());
|
||||
assertEquals("{\"reason\":\"error\"}", response.getContentAsString());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user