Closed
Description
Is this a bug report?
Yes
Have you read the Bugs section of the How to Contribute guide?
Yes
Environment
react-native -v
: 0.43.3node -v
: v7.6.0npm -v
: 5.3.0yarn --version
:
Then, specify:
- Target Platform: iOS
- Development Operating System: macOS
- Build tools: react-native run-ios --simulator='iPhone 7'
Steps to Reproduce
Getting response.json() from GET request causes the error.
try {
//let url = getCustomTokenURL(userId);
let url = 'https://www.reddit.com/r/bitcoin/hot.json';
console.log('URL: ' + url);
let response = await fetch(url);
let responseJson = await response.json();
console.log('JSON:' + responseJson.token);
} catch (error) {
console.log('Error getting custom key: ' + error.stack);
}
Expected Behavior
I thought I'd get the JSON from the link. I'm actually trying to use localhost, but I used Reddit to see if it still occurred with HTTPS, which it does.
Actual Behavior
I received the error in the title after the '-' and got the following stacktrace (note the link definitely returns json):
Error getting custom key: TypeError: Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'.
at readBlobAsText (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:6045:12)
at Response.Body.text (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:6139:16)
at Response.Body.json (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:6156:19)
at LoggedOutPage._callee2$ (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:66485:56)
at tryCatch (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7396:40)
at Generator.invoke [as _invoke] (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7584:22)
at Generator.prototype.(anonymous function) [as next] (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7421:21)
at tryCatch (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7396:40)
at invoke (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7454:20)
at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7462:13
Reproducible Demo
¯\_(ツ)_/¯