Skip to content

Commit e02fbe2

Browse files
authored
Merge pull request #31 from CodingAleCR/fix/custom-class-usage
Fix: Custom class usage.
2 parents 1fad1b7 + 1fb9cdc commit e02fbe2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/http_client_with_interceptor.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ class HttpClientWithInterceptor extends BaseClient {
211211
response = await Response.fromStream(stream);
212212
if (retryPolicy != null &&
213213
retryPolicy.maxRetryAttempts > _retryCount &&
214-
await retryPolicy.shouldAttemptRetryOnResponse(response)) {
214+
await retryPolicy.shouldAttemptRetryOnResponse(
215+
ResponseData.fromHttpResponse(response))) {
215216
_retryCount += 1;
216217
return _attemptRequest(request);
217218
}

lib/models/retry_policy.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import 'package:http/http.dart';
1+
import 'package:http_interceptor/models/models.dart';
22

33
abstract class RetryPolicy {
44
bool shouldAttemptRetryOnException(Exception reason) => false;
5-
Future<bool> shouldAttemptRetryOnResponse(Response response) async => false;
5+
Future<bool> shouldAttemptRetryOnResponse(ResponseData response) async =>
6+
false;
67
final int maxRetryAttempts = 1;
78
}

0 commit comments

Comments
 (0)