XHR fails with "Invalid response for blob" on Android
See original GitHub issue- [x ] I have reviewed the documentation
- [x ] I have searched existing issues
- [x ] I am using the latest React Native version
React crash on fetch, Android only Similar to https://github.com/facebook/react-native/issues/18223 (but this is only ios) Similar to https://github.com/facebook/react-native/issues/18190 (but my response is not empty and the response code is 200)
Environment
Environment: OS: macOS High Sierra 10.13.3 Node: 9.6.1 Yarn: 1.5.0 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.54.0 => 0.54.0
Steps to Reproduce
that’s enough to crash on Android (it works all right on ios) Emulated on google Pixel android 27
fetch(https://crypto-viewer.rebeleo.com/updates/en-US/android
)
.then(res => res.json())
.then(data => ({ data }))
.catch(err => {
alert('Something went wrong with the Updatesfeed 😦 => ’ + err)
return { err }
})
Expected Behavior
Expect the type of the response to be seen as json
Actual Behavior
This is a regression issue. The response is seen as empty, and as blob
// Is going in this branch
case ‘blob’:
if (typeof this._response === ‘object’ && this._response) {
this._cachedResponse = BlobManager.createFromOptions(this._response);
} else {
throw new Error(Invalid response for blob: ${this._response}
);
}
break;
Issue Analytics
- State:
- Created 6 years ago
- Reactions:21
- Comments:79 (11 by maintainers)
Because nobody has provided a way to reproduce this bug and there’s no way to test whatever fix we do actually works.
@satya164
Here is a repro:
https://github.com/TheSavior/react-native-blob-repro
The relevant lines are the server:
and the react-native app: