Fix UTF-8 handling in ContentResultMatchers

Closes gh-23622
This commit is contained in:
Sebastien Deleuze
2019-09-13 11:43:10 +02:00
parent 5d785390eb
commit 7b4b64b8fb
2 changed files with 30 additions and 29 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.test.web.servlet.result;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
@@ -210,7 +211,7 @@ public class ContentResultMatchers {
*/
public ResultMatcher json(String jsonContent, boolean strict) {
return result -> {
String content = result.getResponse().getContentAsString();
String content = result.getResponse().getContentAsString(StandardCharsets.UTF_8);
this.jsonHelper.assertJsonEqual(jsonContent, content, strict);
};
}