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

Bad state: Stream has already been listened to when accessing response stream in RetryClient.when #1226

Open
blaugold opened this issue Jun 5, 2024 · 0 comments
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@blaugold
Copy link

blaugold commented Jun 5, 2024

Reading stream of response in when function of RetryClient causes Bad state: Stream has already been listened to to be thrown from https://github.com/dart-lang/http/blob/master/pkgs/http/lib/retry.dart#L125.

Possible fix:

try {
  _unawaited(response.stream.listen((_) {}).cancel().catchError((_) {}));
} catch (_) {}
@blaugold blaugold added package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant