-
Notifications
You must be signed in to change notification settings - Fork 42
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
add a next interceptor handler on DioInterceptor for missing mocks #159
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
===========================================
+ Coverage 99.28% 100.00% +0.71%
===========================================
Files 24 25 +1
Lines 280 293 +13
===========================================
+ Hits 278 293 +15
+ Misses 2 0 -2
☔ View full report in Codecov by Sentry. |
Thank you @sebastianbuechler for your contribution, our community appreciates it! |
@LukaGiorgadze So a solution that just allows to inject a logger into the |
I think it't fine unless we are not too much dependent on that logger. So I'll approve PR. |
I was thinking about using the https://github.com/Milad-Akarie/pretty_dio_logger so that everybody can decide for themselves, but I saw that we have here some usecases (like "route matched"), that would not been covered with this approach. By the way, I'm not allowed to merge the PRs that are approved and open. Can you merge them? Also, do you want to make a new release afterward? |
@sebastianbuechler I promoted you as a maintainer, now you should be able to push changes too. |
e1790ad
to
f3edabe
Compare
@LukaGiorgadze Thanks! I just did a rebase in order to have a clean state for merging. Do you want to downgrade the collection package via PR? |
Thanks, this is a proper way to update PR's before we merge. |
This PR is a proposal for issue #136.
This package has two ways of mocking for Dio:
It is my understanding that selective mocking only works for the first one as the latter one completely exchanges the HttpClientAdapter of Dio.
My proposed solution is to add a boolean failOnMissingMock, which is by default true for backwards compatibility. If set to false we do not throw an exception anymore when a mock is not matched, but instead send back a Future.value(null). This way we can detect the mismatch in the DioInterceptor and let Dio call the next interceptor.
Also, I added an option to output logs which are by default turned off and use the common logger package: https://pub.dev/packages/logger
@LukaGiorgadze what do you think?