在react native中使用https模块



我想在react native中使用nodejs中的https标准库模块(我需要axios的https.Agent(。有合适的方法吗?

它也可以使用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

最新更新