如何在 fetch 或 axios API 调用中的 React Native Expo 中禁用 SSL

7 ssl fetch react-native axios expo

我正在尝试在 React Native 博览会中禁用 SSL

这是我尝试过的

import * as https from "https"

const agent = new https.Agent({
  rejectUnauthorized: false,
});

let response = await axios(options, { httpsAgent: agent });
Run Code Online (Sandbox Code Playgroud)

但它在 npm start 上抛出错误

在尝试https从文件解析模块时,成功找到了D:\work\ALPHA OBS\gosi\app\screens\Authentication\signIn.js包。D:\work\ALPHA OBS\gosi\node_modules\https\package.json然而,这个包本身指定了一个main无法解析的模块字段(D:\work\ALPHA OBS\gosi\node_modules\https\index.js。事实上,这些都没有

请指导我解决这个问题。