Skip to content

Commit 0cb97d8

Browse files
committed
[http] Document that RetryClient's when callback owns the response body it reads
1 parent f9c259c commit 0cb97d8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎pkgs/http/lib/retry.dart‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ final class RetryClient extends BaseClient {
4343
/// response [when] returns `true`. If [whenError] is passed, it also retries
4444
/// any request that throws an error for which [whenError] returns `true`.
4545
///
46+
/// If [when] reads the response body (via
47+
/// `(response as StreamedResponse).stream`), it is responsible for draining
48+
/// or cancelling the stream. A body can only be read once, so if [when]
49+
/// returns `false`, reading the returned response's body (including through
50+
/// [get], [post], etc.) will throw a [StateError].
51+
///
4652
/// By default, this waits 500ms between the original request and the first
4753
/// retry, then increases the delay by 1.5x for each subsequent retry. If
4854
/// [delay] is passed, it's used to determine the time to wait before the

0 commit comments

Comments
 (0)