Fix "type 'Response' is not a subtype of type 'StreamedResponse' in type cast" after retrying a request#155
Closed
KacperKluka wants to merge 2 commits intoCodingAleCR:mainfrom
Closed
Fix "type 'Response' is not a subtype of type 'StreamedResponse' in type cast" after retrying a request#155KacperKluka wants to merge 2 commits intoCodingAleCR:mainfrom
KacperKluka wants to merge 2 commits intoCodingAleCR:mainfrom
Conversation
…ype cast" after retrying a request
grAPPfruit
approved these changes
Feb 24, 2025
|
We have the same problem and are waiting for this fix to get merged. |
Author
|
@CodingAleCR could you please find some time to look at the fix and include it in the next release? 🙇 Thanks! ❤️ |
|
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. |
|
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. |
Author
|
I can see that this has been fixed recently as a part of #161 so I will close my PR |
Owner
|
@all-contributors add @KacperKluka for code and bugfixes |
Contributor
|
I've put up a pull request to add @KacperKluka! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue description:
When you use the library in version
2.0.0and create theInterceptedClientwith aretryPolicyand then call thesend()method it throws a"type 'Response' is not a subtype of type 'StreamedResponse' in type cast"exception after theretryPolicywas used to retry the request.Proposed fix:
After #132 the
_attemptRequest()method has received an optional parameterisStreamset by default tofalse. When theretryPolicyis invoked inside the method, the_attemptRequest()is recursively called again but theisStreamparameter isn't passed through, but rather the default value is being used. Due to that even if you call_attemptRequest(isStream: true)then after usingretryPolicyit will be called again but with the default valuefalse, which then leads to the type cast error.Hopefully, it could possibly fix the #134 if it isn't resolved already 😉