关于spring如何获取Content-Type不同的参数
- application/x-www-form-urlencoded:@RequestParam or request.getParamter()
- application/json:@RequestBody
关于axios设置Content-Type格式
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
关于请求json数据如何转换成application/x-www-form-urlencoded的数据格式
data: qs.stringify(data),
为什么需要这样做
axios请求参考
{
url: '/auth/oauth/token',
method: 'post',
data: qs.stringify(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
auth: {
username: 'pc',
password: 'secret'
},
}