Improper UTF-8 handling in MockMvc for JSON response #23622
Labels
in: test
Issues in the test module
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: regression
A bug that is also a regression
Milestone
When
MediaType.APPLICATION_JSON_UTF8
was deprecated, the content type of JSON that gets sent from a@RestController
changed toapplication/json
(without charset).This breaks
MockMvc
tests that use.andExpect(content().json())
. Here is a sample test:The test runs fine with Spring 5.1.9 but fails with Spring 5.2.0.RC2
You can find a sample Spring Boot project to reproduce the problem at https://github.com/sgybas/mockmvc-json-utf8
There was a similar issue for
jsonPath()
(#23219).The text was updated successfully, but these errors were encountered: