const agent = new https.Agent({
rejectUnauthorized: false
});
return new Promise((resolve, reject) => {
// params,传对象就可以了
axios
.post(url, json ? JSON.stringify(params) : QS.stringify(params), {
headers: json ? headerJSON : headerFormData,
httpsAgent: agent
})
// instance.post(url,JSON.stringify(params))
.then(res => {
console.info(res.data)
resolve(res.data);
})
.catch(err => {
console.info(err.data)
reject(err.data);
});
用httpAgent还是没有作用