错误提示:
2022-05-17 19:25:16.286 WARN 7872 --- [nio-8080-exec-4]
.m.m.a.ExceptionHandlerExceptionResolver : Resolved
[org.springframework.http.converter.HttpMessageNotReadableException: Required request body
is missing: public com.woniu.bean.Result
com.woniu.controller.UserController.updateUser(com.woniu.bean.User)]
错误原因:简写axios时忘写参数了,错误代码如下
axios.put("http://localhost:8080/userServe")
.then(resp=>{
if(resp.data.code===20031){
console.log(resp.data);
location.href = "/pages/user/user-list.html";
}else {
console.log(resp.data);
}
})
正确代码:
axios.put("http://localhost:8080/userServe",this.user)
.then(resp=>{
if(resp.data.code===20031){
console.log(resp.data);
location.href = "/pages/user/user-list.html";
}else {
console.log(resp.data);
}
})