https 在 React Native axios 中未定义

Dre*_*nch 7 https reactjs 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)

Ngo*_*uan -2

这是 Android 9 或 10 的问题,您必须在 Apache 配置中添加 SSLCertificateChainFile。

SSLCertificateChainFile "/opt/bitnami/apache2/conf/server-ca.crt"

然后它就会正常工作