JSON charset handling in StringHttpMessageConverter
This commit restores the interpretation of JSON as UTF-8 by default that was removed in #bc205e0 and also ensures a charset is not appended automatically to "application/json". Closes gh-24123
This commit is contained in:
@@ -1011,7 +1011,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
|
||||
request.addHeader("Accept", "application/json, text/javascript, */*");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
getServlet().service(request, response);
|
||||
assertThat(response.getHeader("Content-Type")).as("Invalid content-type").isEqualTo("application/json;charset=ISO-8859-1");
|
||||
assertThat(response.getHeader("Content-Type")).as("Invalid content-type").isEqualTo("application/json");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1548,7 +1548,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
|
||||
getServlet().service(request, response);
|
||||
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
assertThat(response.getHeader("Content-Type")).isEqualTo("application/json;charset=ISO-8859-1");
|
||||
assertThat(response.getHeader("Content-Type")).isEqualTo("application/json");
|
||||
assertThat(response.getContentAsString()).isEqualTo("homeJson");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user