【为什么改了请求头中 Content-Type 的请求格式为 application/x-www-form-urlencoded,但是请求的格式还是 application/json 格式的?】
修改 Content-Type 的代码
this.axios
.post(
'/shop/goods/list/v2',
{
categoryId: 263919,
},
{
headers: {
'content-type': 'application/x-www-form-urlencoded',
},
}
)
.then(res => {
this.goodsList = res
})
传递的依然是 application/json 格式的
改成
因为 axios 不会给你自动转换这些东西的。本身
'application/x-www-form-urlencoded'
也好几种规范。