-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work for Flutter Web, fails with XMLHttpRequest error #26
Comments
Same issue happened to me, is there any workaround or solution? |
Your backend must have an endpoint that accepts OPTIONS request (it's called a Preflight request) and send response with status code 204 to it. Literally if you request GET https://example.com/users/profile a browser will first try to do it with OPTIONS https://example.com/users/profile and when it gets 204 then it will try GET. Make sure your backend can process it |
Then why does it work with flutter mobile ?
…On Tue, May 25, 2021, 9:23 PM Konstantin Serov ***@***.***> wrote:
Your backend must have an endpoint that accepts OPTIONS request (it's
called a Preflight request) and send response with status code 204 to it.
Literally if you request GET https://example.com/users/profile a browser
will first try to do it with OPTIONS https://example.com/users/profile
and when it gets 204 then it will try GET. Make sure your backend can
process it
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBQRDMAR47RLP6CSYJG6ILTPPBWTANCNFSM4ZDQQR4A>
.
|
Because Flutter mobile is not a browser. Only web browsers send Preflight requests. |
this solves the issue for testing locally |
I have the same issue, and we are going across sites to fetch meta data. For example, if someone posts a YouTube link. How can we get around this? |
Stack Trace
` Error: XMLHttpRequest error.
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 906:28 get current
packages/http/src/browser_client.dart 71:22
dart-sdk/lib/async/zone.dart 1612:54 runUnary
dart-sdk/lib/async/future_impl.dart 152:18 handleValue
dart-sdk/lib/async/future_impl.dart 704:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 733:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 530:7 [_complete]
dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
dart-sdk/lib/async/stream.dart 1219:7
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58
I tried to run the sample code and it fails, Is this a known bug ?
The text was updated successfully, but these errors were encountered: