mockMvc
.perform(MockMvcRequestBuilders
.post("/mock/post")
.content(JSON.toJSONString(person1))
.contentType(MediaType.APPLICATION_JSON)
.header("X-Access-token", "1"))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn().getResponse().setCharacterEncoding("UTF-8");
MockHttpServletResponse:
Status = 200
Error message = null
Headers = [Content-Type:"application/json"]
Content type = application/json
Body = {"code":200,"result":"å
许è¿å
¥"}
Forwarded URL = null
Redirected URL = null
Cookies = []
HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked
Date: Wed, 03 Feb 2021 03:13:42 GMT
Keep-Alive: timeout=60
Connection: keep-alive
{
"code": 200,
"result": "允许进入"
}
不知道怎么办了。。求助
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.