请求的对象requestconst req = { a: 1, b: { c: 2, d: 3
}
}实际请求时候的form data
1 回答
交互式爱情
TA贡献1712条经验 获得超3个赞
发现自己不小心写了一个axios装饰器代码:
axios.interceptors.request.use(function (config) { console.log(config);
config.transformRequest = [function (data) { let ret = ''; for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&';
} return ret;
}]; // 在发送请求之前做些什么
return config;
}, function (error) { // 对请求错误做些什么
return Promise.reject(error);
});添加回答
举报
0/150
提交
取消
