Skip to content
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

Updated README.md to add a section "CORS on Flutter Web" #1763

Closed
wants to merge 3 commits into from

Conversation

Shuo-Li
Copy link
Contributor

@Shuo-Li Shuo-Li commented Mar 27, 2023

CORS on Flutter Web

When using Dio with Flutter Web, be aware of Web Browser CORS Pre-flight Requests. You won't encounter this on mobile platforms like Android/IOS. However, Pre-flight requests always happen with Flutter web when one makes a REST Api call such as dio.post() or dio.get() with headers.

The way to handle browser pre-flight requests is to enable CORS on your web server. Most web server frameworks or libraries provide CORS middleware to handle browser pre-flight requests.

New Pull Request Checklist

  • I have read the Documentation
  • I have searched for a similar pull request in the project and found none
  • I have updated this branch with the latest main branch to avoid conflicts (via merge from master or rebase)
  • I have added the required tests to prove the fix/feature I'm adding
  • I have updated the documentation (if necessary)
  • I have run the tests without failures
  • I have updated the CHANGELOG.md in the corresponding package

Additional context and info (if any)

Added the following section without modifying anything else: 

## Flutter Web

When using Dio with Flutter Web, be aware of Web Browser CORS Pre-flight Requests. You won't encounter this on mobile platforms like Android/IOS. However, Pre-flight requests always happen with Flutter web when one makes a REST Api call such as dio.post() or dio.get() with headers.

The way to handle browser pre-flight requests is to enable CORS on your web server. Most web server frameworks or libraries provide CORS middleware to handle browser pre-flight requests.


Signed-off-by: Shuo Li <6397910+Shuo-Li@users.noreply.github.com>
Change the section title to "CORS on Flutter Web"

Signed-off-by: Shuo Li <6397910+Shuo-Li@users.noreply.github.com>
@Shuo-Li Shuo-Li requested a review from a team as a code owner March 27, 2023 03:52
@AlexV525
Copy link
Member

Please also update the description accordingly and the README_ZH.md.

@Shuo-Li
Copy link
Contributor Author

Shuo-Li commented Mar 28, 2023

Just added the Chinese section to README_ZH.md and created the PR for both README_.md & README_ZH.md

@AlexV525 AlexV525 closed this Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants