Skip to content

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

Closed

Description

@blaugold

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 (_) {}

Activity

  1. added
    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
    on Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions