【问题标题】:Can I run a raw CURL command from within React Native?我可以在 React Native 中运行原始 CURL 命令吗?
【发布时间】:2020-06-12 02:46:51
【问题描述】:

尝试从我们的 React Native 应用程序运行原始 cURL(需要指定 HTTP1.1 连接)。这可以在 React Native 中实现吗?

 curl -X POST 'https://example.com/Authentication/connect/token' --http1.1 -H 'Content-Type: application/x-www-form-urlencoded

【问题讨论】:

    标签: javascript react-native http curl http2


    【解决方案1】:

    不,你不能那样做。因为curl 是一个UNIX/Linux shell 程序。

    【讨论】:

      【解决方案2】:

      你可以安装 axios 并在 React Native 中使用它。

      【讨论】:

      • 谢谢,我对 axios 很熟悉,但它不允许您指定与原始 cURL 请求相同的命令
      猜你喜欢
      • 2020-11-12
      • 1970-01-01
      • 2020-01-27
      • 1970-01-01
      • 1970-01-01
      • 2020-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多