首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rn-fetch-blob:如何在主体中使用参数发出post请求?

rn-fetch-blob:如何在主体中使用参数发出post请求?
EN

Stack Overflow用户
提问于 2020-07-31 01:53:28
回答 1查看 351关注 0票数 0

嗨,这可能是一个愚蠢的问题,但我真的很困惑如何使用rn-fetch-blob!https://github.com/joltup/rn-fetch-blob发送包含主体中项目的POST请求

下面是我的POST请求代码,但它抛出了一个"Unable to symbolicate : the stack is null“

代码语言:javascript
复制
const data = 'guid='+guid+'&username='+username+'&pass='+password;

let response = await RNFetchBlob.config({ trusty: certificate })
                .fetch('POST', httpOrhttps + "://" + ipAddress + ":" + portNumber + 
                  "/setup/", RNFetchBlob.base64.encode(data))
                .catch(async (error) => { console.error(error); });

然而,我的GET post工作得很好。

代码语言:javascript
复制
let response = await RNFetchBlob.config({ trusty: certificate})
               .fetch('GET', httpOrhttps + "://" + ipAddress + ":" + httpPort + "/setup/guid=" + guid 
                             + "&username=" + username + "&pass=" + password)
              .catch(async (error) => { console.error(error); });

依赖关系:

代码语言:javascript
复制
"dependencies": {
    "@react-native-community/async-storage": "^1.11.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/bottom-tabs": "^5.7.1",
    "@react-navigation/drawer": "^5.8.5",
    "@react-navigation/material-bottom-tabs": "^5.2.13",
    "@react-navigation/native": "^5.7.0",
    "@react-navigation/stack": "^5.7.0",
    "react": "16.13.1",
    "react-native": "0.63.1",
    "react-native-device-info": "^5.6.3",
    "react-native-dropdown-picker": "^3.1.11",
    "react-native-elements": "^2.0.4",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-paper": "^4.0.0",
    "react-native-reanimated": "^1.9.0",
    "react-native-safe-area-context": "^3.1.1",
    "react-native-screens": "^2.9.0",
    "react-native-vector-icons": "^7.0.0",
    "rn-fetch-blob": "^0.12.0"
  },
EN

回答 1

Stack Overflow用户

发布于 2020-07-31 04:36:23

Ciao,很难理解为什么,但最重要的是这个错误发生在哪里(我的意思是,肯定发生在rn-fetch-blob中,但确切地说是在哪里)。我这么说是因为,观察react native ExceptionsManager.js code,在函数reportException中,如果没有接收prettyStack,它将返回The stack is null (所以我们没有要分析的堆栈)。

我找到了this,但太旧了,除了3个众所周知的命令之外,没有其他解决方案:

代码语言:javascript
复制
rm -rf ~/.rncache
watchman watch-del-all
npm start -- reset-cache

你可能已经试过了。

另一件事:您有最新版本的rn-fetch-blob。您可以尝试降级到10或11 (您可以这样做,因为您有原生的react 0.63)。

就这样。如果我会找到其他线索,我会在这个答案上添加一个评论。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63178696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档