我想使用标题内容类型将数据发布到服务器:'application / xww-form-urlencode'但由于内容类型更改为application / json而失败
var headers= {
'content-type': 'application/x-www-form-urlencoded',
'x-access-key': 'key'
}
var data = {
'twins' : twins
}
axios.post('url', data, { headers: headers })
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
在你的标题中将content-type
更改为
'Content-Type': 'application/x-www-form-urlencoded'
如果这不起作用,那么我觉得你可能正在使用拦截器。这可能会覆盖您的配置。