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