How to check JSON in response body with mockMvc

前端 未结 3 793
野趣味
野趣味 2020-12-30 18:53

This is my method inside my controller which is annotated by @Controller

@RequestMapping(value = \"/getServerAlertFilters/{serverName}/\", produ         


        
3条回答
  •  遥遥无期
    2020-12-30 19:15

    The 406 Not Acceptable status code means that Spring couldn't convert the object to json. You can either make your controller method return a String and do return json.toString(); or configure your own HandlerMethodReturnValueHandler. Check this similar question Returning JsonObject using @ResponseBody in SpringMVC

提交回复
热议问题