-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use modern Fetch API with Dio on Web #1740
Comments
In the meantime, you're able to write your own adapter, which makes use of fetch instead of xhr. If you happen to do so, we would appreciate a PR. If we work on this, we should check for browser compatibility before starting. |
Regarding the Fetch API, I just found a new plugin that integrates the Fetch API for the |
We recently received many requests related to obtaining streams directly on the Web platform. This might have a higher priority to implement as a new Dio instance or adapter. |
Theoretically, you could wrap the http The ConversionLayerAdapter could maybe its own package to allow an easy interopt between http and dio |
You can directly use |
it is necessary to add in ConversionLayerAdapter or make another layer like that with another name or should we directly add to browser_adapter |
@meetdhanani17 I'm not sure, I understand what you're trying to say. Right now, you can't use the ConversionLayerAdapter outside of the |
Request Statement
I am trying to figure out Dio and CORS on web. Google is used here as an example, but it could be anything.
Currently if you were to make a request with Dio to "https://www.google.com/" on web. Your request would fail with a transport error, as the browser blocks the request because Google does not reply with the header that allows the browser to do this.
This is done to prevent websites from sending requests to Google with your current cookies, which could be dangerous.
But what happens if you just want to request the page without cookies? As if you were never logged in at all. It seems that XMLHttpRequest only wants to send cookies, or not send anything at all.
Is this doable with the modern Fetch API? https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
It looks like there are different modes for cors. Possibly one with this effect?
If so than should there be an option to use this modern Fetch API with Dio? Especially when modern Fetch API allows for streaming, which is not possible with XMLHttpRequest.
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: