-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
How to test http client with interceptor? TimeoutException after ... Future not completed #118
Comments
Hi, have you tried sending a InterceptedClient.build(
interceptors: [AuthorizationInterceptor(storage: storage)],
retryPolicy: ExpiredTokenRetryPolicy(
authRepository: authRepository,
storage: storage,
),
client: MockClient(),
); Let me know if that helps. Cheers from CR 🇨🇷 |
Hi, thanks for your reply! Thanks to your hint I have created something like this:
previously errors with timeout is disapear, but now I have a
error. Maybe I should mock http server somehow? |
I will take a closer look with |
Any updates? :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi sorry, hectic months. I. haven't gotten around to trying tests with mocktail. But it's getting to the top of my list too so I'm hoping to dive into it soon. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Describe the bug
I wonder how to test http client with intercepor. I get every time
TimeoutException after 0:00:15.000000: Future not completed
orPrzekroczono limit czasu semafora.
if I remove timeout in client.get(...). Below there are my classes, I hope you can easly reproduce issue.To Reproduce
Steps to reproduce the behavior:
lib\
authentication_repository.dart
material.dart
material.g.dart
storage_service.dart
token.dart
warehouse_api_client.dart
test\my_test.dart
.env.development
pubspec.yaml
Expected behavior
I want to test my api where I use http client with interceptor but when I run test the async method takes few seconds and return error that I have mentioned above.
Please complete the following information):
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19042.2194], locale pl-PL)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.3)
[√] IntelliJ IDEA Community Edition (version 2022.1)
[√] VS Code (version 1.73.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
! Doctor found issues in 2 categories.
The text was updated successfully, but these errors were encountered: