1、400错误码
项目中使用的axios发送请求
axios默认的请求头的格式是:application/json
如果后端没有使用@RequestBody
注解接受参数,则会出现前后端接受类型不一致,出现400错误码
2、415错误码
post提交时header中的contentType类型异常,把类型改成对应的类型即可
export function editUser(params) {
return request({
url: 'test/user/edit',
method: 'post',
data: params,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}