Closed pmah8 closed 3 years ago
Going to close this. Just another CORS case it seems. It works if I use the cors_anywhere proxy. I wasn't certain since I didn't get any details on the error message. I also didn't understand CORS enough to know that it doesn't apply to mobile which is why it worked there.
I have some simple code to call this yahoo finance API:
`query = 'https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL';
final http.Response response = await http.get(Uri.parse(query));
if (response.statusCode == 200) { // do stuff here }`
It works fine in android but when it is run in Flutter web (Chrome) it doesn't complete. After a few seconds I get a "XMLHttpRequest error" with no other details.
Here is the curl output
`$ curl -v "https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL"
If I try with this endpoint:
query = 'https://jsonplaceholder.typicode.com/todos/1';
Here is the curl output:
`$ curl -v "https://jsonplaceholder.typicode.com/todos/1"
I get a response so it is something with the Yahoo API response. I don't know why it works on Android and not web though.