我已经使用 axios 来响应本机应用程序,但是在实现 https.agent 时,它显示 https 未定义。如何解决这个问题?
我的代码
const instance = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
instance.get('https://example.com');
// At request level
const agent = new https.Agent({
rejectUnauthorized: false
});
axios.post('/practz/login', {
"username" :"orgadmin1@example.com",
"password":"exam",
"appId":"AABBCD",
"domainName":"example.com",
httpsAgent: agent
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});