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

Fix: example queued_interceptor_csrftoken.dart #2128

Closed
wants to merge 3 commits into from

Conversation

seunghwanly
Copy link
Contributor

Provide a more suitable example for queued_interceptor_csrftoken.dart

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)

This example adds 2 different QueuedInterceptorsWrapper and the last one handles onError to update csrf token.

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/'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use httpbun.com instead.

Copy link
Contributor Author

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';
Copy link
Member

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?

Copy link
Contributor Author

@seunghwanly seunghwanly Mar 10, 2024

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

@seunghwanly
Copy link
Contributor Author

seunghwanly commented Mar 10, 2024

Failed test/test_suite_test.dart

Not sure why did it failed after extra commit

seunghwanly added a commit to seunghwanly/dio that referenced this pull request Mar 13, 2024
newly forked a branch from cfug/dio to test if the test completes as before (100% passed)

cfug#2128 (comment)
@seunghwanly
Copy link
Contributor Author

I think there may be a syncing issue between my old fork repository and the current cfug/dio.
Closing this pr

github-merge-queue bot pushed a commit that referenced this pull request Mar 19, 2024
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
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