Fetch API does not support getReader (response.body is undefined)
Abierto
Nadie ha tomado este issue todavía.
🌐Networking
Needs: Triage :mag:
Newer Patch Available
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.3k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 4
Descripción
Description
When trying to read the response from Fetch as a stream, via getReader(), I get an error saying that resp.body is undefined. Logging the value of resp shows this:
{"_bodyBlob": {"_data": {"__collector": [Object], "blobId": "xxx", "name": "chat.txt", "offset": 0, "size": 42, "type": "text/plain"}}, "_bodyInit": {"_data": {"__collector": [Object], "blobId": "xxx", "name": "chat.txt", "offset": 0, "size": 42, "type": "text/plain"}}, "bodyUsed": false, "headers": {"map": {"cache-control": "no-store", "content-length": "42", "content-type": "text/plain; charset=utf-8", "date": "Sun, 21 May 2023 18:53:09 GMT", "expect-ct": "max-age=2592000, report-uri=\"https://sentry.repl.it/api/10/security/?sentry_key=xxx\"", "replit-cluster": "hacker", "strict-transport-security": "max-age=6123043; includeSubDomains", "uwebsockets": "20"}}, "ok": true, "status": 200, "statusText": "", "type": "default", "url": "https://xxx.luisafk.repl.co/chat"}
Duplicate of #25701 and #25910, but they were closed.
React Native Version
0.71.7
Output of npx react-native info
System:
OS: macOS 12.6.3
CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
Memory: 346.30 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.7.0 - ~/.nvm/versions/node/v19.7.0/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v19.7.0/bin/yarn
npm: 9.5.0 - ~/.nvm/versions/node/v19.7.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK: Not Found
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: /undefined - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.7 => 0.71.7
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
Try the code example below.
Snack, code example, screenshot, or link to a repository
const resp = await fetch('https://example.com');
const reader = resp.body.getReader();
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza ejecutando la reproducción proporcionada de fetch/getReader en React Native 0.71.7 e inspecciona el comportamiento del cuerpo de la respuesta de la Fetch API. Se considera completado cuando resp.body está disponible y resp.body.getReader() funciona para la respuesta reproducida sin el error undefined.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, react
- Área
- api, mobile
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100