mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Support setCharacterEncoding(null) in MockHttpServletResponse
Closes gh-30341
This commit is contained in:
+12
@@ -195,6 +195,18 @@ class MockHttpServletResponseTests {
|
||||
assertThat(response.getCharacterEncoding()).isEqualTo("UTF-8");
|
||||
}
|
||||
|
||||
@Test
|
||||
void setCharacterEncodingNull() {
|
||||
response.setContentType("test/plain");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
assertThat(response.getContentType()).isEqualTo("test/plain;charset=UTF-8");
|
||||
assertThat(response.getHeader(CONTENT_TYPE)).isEqualTo("test/plain;charset=UTF-8");
|
||||
response.setCharacterEncoding(null);
|
||||
assertThat(response.getContentType()).isEqualTo("test/plain");
|
||||
assertThat(response.getHeader(CONTENT_TYPE)).isEqualTo("test/plain");
|
||||
assertThat(response.getCharacterEncoding()).isEqualTo(WebUtils.DEFAULT_CHARACTER_ENCODING);
|
||||
}
|
||||
|
||||
@Test
|
||||
void defaultCharacterEncoding() {
|
||||
assertThat(response.isCharset()).isFalse();
|
||||
|
||||
Reference in New Issue
Block a user