HttpMessageNotReadableException: Required request body is missing:

今天使用cv大法写一个接口的时候,出现了一个问题

HttpMessageNotReadableException: Required request body is missing:

1. 前后端使用的都是post请求,所以不是请求方式的问题

2. 后端的controller中使用了 @RequestBody,去除 @RequestBody 后可以请求(但我要的是post请求)

 3. 查看浏览器的network请求,发现是post请求,状态码也是200,但是请求的参数都被拼接到了url后面,就像get请求那样,很奇怪。以为是接口路径的问题,于是在postmapping后面加了一段路径,这时出现了下面的错误。。。。

Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: Invalid character found in the request target

最后请教大佬,post请求这里一定要是data

原文地址:https://www.cnblogs.com/Guhongying/p/14533256.html