Remove charset parameter from Spring MVC JSON content type

This change is a follow-up to the ones done as part of gh-22788.

Closes gh-22954
This commit is contained in:
Sebastien Deleuze
2019-05-27 18:14:19 +02:00
parent 30944ed2e2
commit bc205e0dbf
3 changed files with 1 additions and 25 deletions

View File

@@ -293,7 +293,7 @@ public class RequestResponseBodyMethodProcessorTests {
processor.writeWithMessageConverters("Foo", returnTypeString, request);
assertThat(servletResponse.getHeader("Content-Type")).isEqualTo("application/json;charset=UTF-8");
assertThat(servletResponse.getHeader("Content-Type")).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
}
@Test
@@ -676,22 +676,6 @@ public class RequestResponseBodyMethodProcessorTests {
assertThat(content.contains("\"name\":\"bar\"")).isTrue();
}
@Test // SPR-13631
public void defaultCharset() throws Exception {
Method method = JacksonController.class.getMethod("defaultCharset");
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
MethodParameter methodReturnType = handlerMethod.getReturnType();
List<HttpMessageConverter<?>> converters = new ArrayList<>();
converters.add(new MappingJackson2HttpMessageConverter());
RequestResponseBodyMethodProcessor processor = new RequestResponseBodyMethodProcessor(converters);
Object returnValue = new JacksonController().defaultCharset();
processor.handleReturnValue(returnValue, methodReturnType, this.container, this.request);
assertThat(this.servletResponse.getCharacterEncoding()).isEqualTo("UTF-8");
}
@Test // SPR-14520
public void resolveArgumentTypeVariableWithGenericInterface() throws Exception {
this.servletRequest.setContent("\"foo\"".getBytes("UTF-8"));