【发布时间】:2021-02-19 08:33:52
【问题描述】:
我想在 react native 中使用 nodejs 的 https 标准库模块(我需要 https.Agent for axios)。有没有合适的方法来做到这一点?
【问题讨论】:
标签: javascript android node.js react-native
我想在 react native 中使用 nodejs 的 https 标准库模块(我需要 https.Agent for axios)。有没有合适的方法来做到这一点?
【问题讨论】:
标签: javascript android node.js react-native
也可以使用 JavaScipt 的内置函数 'fetch' 来执行。
例子:
fetch('https://mywebsite.com/endpoint/', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
firstParam: 'yourValue',
secondParam: 'yourOtherValue'
})
});
【讨论】: