今天使用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