Giter Site home page Giter Site logo

Comments (7)

sunnylqm avatar sunnylqm commented on August 26, 2024

expo的麻烦就在于你不能更改原生配置,只能等官方发布新版本
看起来官方是在sdk33中修复了 expo/expo@fdc6a3a

from react-native-website.

ACDC5 avatar ACDC5 commented on August 26, 2024

鱼和熊掌不可兼得?看来expo还不是很完美,还是用react-native init吧

from react-native-website.

ACDC5 avatar ACDC5 commented on August 26, 2024

记录一下,新建一个reactNative项目后将参数格式改为:
image
即key=value的形式后请求成功。没有对android目录内容进行任何配置。

网上解决这个问题的其他方向有:
1、虚拟机的dns要和本机的dns保持一致;
2、需要配置相应平台的网络设置,如ios对http的限制,android也存在类似的问题

from react-native-website.

sunnylqm avatar sunnylqm commented on August 26, 2024
  1. content-type任何形式,与http协议、系统本身对http协议的限制没有任何关系,不可能解决其相关的问题。好比你打电话的音量大小,不可能影响你的话费多少。
  2. content-type具体用什么格式,由服务器决定,它要json格式要xml格式要kv格式,你都得听它的。

from react-native-website.

ACDC5 avatar ACDC5 commented on August 26, 2024

我认为问题出在传参上,Content-Type: application/x-www-form-urlencoded这种格式要求参数以key=value的方式传入;我一开始用的FormData也是k-v格式,正常来说我这样传参是没问题的,但还是出错了。我找到的解释是:FormData.append方法只能在Web Workers 中使用:
image
就是因为这个出现了TypeError: Network request failed错误。

from react-native-website.

sunnylqm avatar sunnylqm commented on August 26, 2024

你的理解还是错误的,
1、form data对应的是multipart/form-data,而不是application/x-www-form-urlencoded
2、form data在web workers中可用,当然不是“只能”。如果是这样,谁还用form data?

from react-native-website.

ACDC5 avatar ACDC5 commented on August 26, 2024

明白了 谢谢

from react-native-website.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.