spring MVC接收请求体总是多一个等号
比如我发送的请求体是字符串aaa
spring MVC 接收到的是aaa=
接口如下:
/***
* @param requestInfoBean
* @return
*/
@RequestMapping(value = "/ajax", produces = SystemHWUtil.RESPONSE_CONTENTTYPE_JSON_UTF)
@ResponseBody
public String ajax(@RequestBody String requestInfoBean,HttpServletRequest request) {
System.out.println(requestInfoBean);
System.out.println(request.getHeader("Content-Type"));
return null;
}
为什么呢?
因为请求的content type不对
应该是:application/json;charset=UTF-8
而我设置的content type是:
application/x-www-form-urlencoded;charset=UTF-8