繁体   English   中英

在 React Native 中使用 https 模块

[英]Use https module in react native

我想在 react native 中使用 nodejs 中的 https 标准库模块(我需要 https.Agent for axios)。 有没有合适的方法来做到这一点?

它也可以使用 JavaScipt 的内置函数“fetch”来执行。

例子 :

fetch('https://mywebsite.com/endpoint/', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    firstParam: 'yourValue',
    secondParam: 'yourOtherValue'
  })
});

更多: https : //reactnative.dev/docs/network

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM