@@ -17,7 +17,7 @@ class RetryClient extends BaseClient {
17
17
final int _retries;
18
18
19
19
/// The callback that determines whether a request should be retried.
20
- final bool Function (StreamedResponse ) _when;
20
+ final bool Function (BaseResponse ) _when;
21
21
22
22
/// The callback that determines how long to wait before retrying a request.
23
23
final Duration Function (int ) _delay;
@@ -37,7 +37,7 @@ class RetryClient extends BaseClient {
37
37
/// given (zero-based) retry.
38
38
RetryClient (this ._inner,
39
39
{int retries,
40
- bool when (StreamedResponse response),
40
+ bool when (BaseResponse response),
41
41
Duration delay (int retryCount)})
42
42
: _retries = retries ?? 3 ,
43
43
_when = when ?? ((response) => response.statusCode == 503 ),
@@ -54,13 +54,15 @@ class RetryClient extends BaseClient {
54
54
/// in order. It will wait for `delays[0]` after the initial request,
55
55
/// `delays[1]` after the first retry, and so on.
56
56
RetryClient .withDelays (Client inner, Iterable <Duration > delays,
57
- {bool when (StreamedResponse response)})
57
+ {bool when (BaseResponse response)})
58
58
: this ._withDelays (inner, delays.toList (), when : when );
59
59
60
60
RetryClient ._withDelays (Client inner, List <Duration > delays,
61
- {bool when (StreamedResponse response)})
61
+ {bool when (BaseResponse response)})
62
62
: this (inner,
63
- retries: delays.length, delay: (retryCount) => delays[retryCount]);
63
+ retries: delays.length,
64
+ delay: (retryCount) => delays[retryCount],
65
+ when : when );
64
66
65
67
Future <StreamedResponse > send (BaseRequest request) async {
66
68
var splitter = new StreamSplitter (request.finalize ());
0 commit comments