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 "type 'Response' is not a subtype of type 'StreamedResponse' in type cast" after retrying a request #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KacperKluka
Copy link

Issue description:
When you use the library in version 2.0.0 and create theInterceptedClient with a retryPolicy and then call the send() method it throws a "type 'Response' is not a subtype of type 'StreamedResponse' in type cast" exception after the retryPolicy was used to retry the request.

Proposed fix:
After #132 the _attemptRequest() method has received an optional parameter isStream set by default to false. When the retryPolicy is invoked inside the method, the _attemptRequest() is recursively called again but the isStream parameter isn't passed through, but rather the default value is being used. Due to that even if you call _attemptRequest(isStream: true) then after using retryPolicy it will be called again but with the default value false, which then leads to the type cast error.

Hopefully, it could possibly fix the #134 if it isn't resolved already 😉

@grAPPfruit
Copy link

We have the same problem and are waiting for this fix to get merged.
Please get to it <3

@KacperKluka
Copy link
Author

@CodingAleCR could you please find some time to look at the fix and include it in the next release? 🙇 Thanks! ❤️

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