小编Dre*_*nch的帖子

https 在 React Native axios 中未定义

我已经使用 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);
      });
Run Code Online (Sandbox Code Playgroud)

https reactjs react-native axios

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

axios ×1

https ×1

react-native ×1

reactjs ×1