-
-
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
Fix: example queued_interceptor_csrftoken.dart #2128
Conversation
When `Dio` is used on web platform, session cookie might needed. Just in this case csrf token is only handled at Headers. This examples adds 2 different `QueuedInterceptorsWrapper` and last one handles `onError` to update csrf token.
String? cachedCSRFToken; | ||
|
||
final dio = Dio() | ||
..options.baseUrl = 'https://httpbin.org/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use httpbun.com
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, changed baseUrl and used mix 👍
@@ -1,92 +1,95 @@ | |||
import 'dart:async'; | |||
import 'dart:convert'; | |||
import 'dart:developer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the main idea and the overall flow at the top with comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added key features and a scenario too
Failed Not sure why did it failed after extra commit |
newly forked a branch from cfug/dio to test if the test completes as before (100% passed) cfug#2128 (comment)
I think there may be a syncing issue between my old fork repository and the current cfug/dio. |
Provide a more suitable example for queued_interceptor_csrftoken.dart <!-- Write down your pull request descriptions. --> ### New Pull Request Checklist - [x] I have read the [Documentation](https://pub.dev/documentation/dio/latest/) - [x] I have searched for a similar pull request in the [project](https://github.com/cfug/dio/pulls) and found none - [x] 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) - [x] I have run the tests without failures - [ ] I have updated the `CHANGELOG.md` in the corresponding package ### Additional context and info (if any) This example adds 2 different `QueuedInterceptorsWrapper` and the last one handles `onError` to update csrf token. --- fixes #2128
Provide a more suitable example for queued_interceptor_csrftoken.dart
New Pull Request Checklist
main
branch to avoid conflicts (via merge from master or rebase)CHANGELOG.md
in the corresponding packageAdditional context and info (if any)
This example adds 2 different
QueuedInterceptorsWrapper
and the last one handlesonError
to update csrf token.