File tree Expand file tree Collapse file tree 6 files changed +17
-6
lines changed Expand file tree Collapse file tree 6 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## 2.0.0-beta.4
4
+
5
+ - ❗️🛠  ;  ; Changed: ` shouldAttemptRetryOnException ` will now also pass the ` BaseRequest ` .
6
+ - 🚦  ;  ; Tests: Updated tests.
7
+
3
8
## 2.0.0-beta.3
4
9
5
10
- 🐞  ;  ; Fixed: ` MultipartRequest ` does not get intercepted correctly (has missing fields).
Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ class ExpiredTokenRetryPolicy extends RetryPolicy {
355
355
int get maxRetryAttempts => 2 ;
356
356
357
357
@override
358
- bool shouldAttemptRetryOnException (Exception reason) {
358
+ bool shouldAttemptRetryOnException (Exception reason, BaseRequest request ) {
359
359
log (reason.toString ());
360
360
361
361
return false ;
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ class InterceptedClient extends BaseClient {
278
278
} on Exception catch (error) {
279
279
if (retryPolicy != null &&
280
280
retryPolicy! .maxRetryAttempts > _retryCount &&
281
- retryPolicy! .shouldAttemptRetryOnException (error)) {
281
+ retryPolicy! .shouldAttemptRetryOnException (error, request )) {
282
282
_retryCount += 1 ;
283
283
return _attemptRequest (request);
284
284
} else {
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ import 'package:http/http.dart';
36
36
abstract class RetryPolicy {
37
37
/// Defines whether the request should be retried when an Exception occurs
38
38
/// while making said request to the server.
39
- bool shouldAttemptRetryOnException (Exception reason) => false ;
39
+ bool shouldAttemptRetryOnException (Exception reason, BaseRequest request) =>
40
+ false ;
40
41
41
42
/// Defines whether the request should be retried after the request has
42
43
/// received `response` from the server.
Original file line number Diff line number Diff line change 1
1
name : http_interceptor
2
2
description : A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
3
- version : 2.0.0-beta.3
3
+ version : 2.0.0-beta.4
4
4
homepage : https://github.com/CodingAleCR/http_interceptor
5
5
issue_tracker : https://github.com/CodingAleCR/http_interceptor/issues
6
6
repository : https://github.com/CodingAleCR/http_interceptor
Original file line number Diff line number Diff line change @@ -17,8 +17,13 @@ main() {
17
17
group ("shouldAttemptRetryOnException" , () {
18
18
test ("returns false by default" , () {
19
19
expect (
20
- testObject
21
- .shouldAttemptRetryOnException (Exception ("Test Exception." )),
20
+ testObject.shouldAttemptRetryOnException (
21
+ Exception ("Test Exception." ),
22
+ Request (
23
+ 'GET' ,
24
+ Uri (),
25
+ ),
26
+ ),
22
27
false );
23
28
});
24
29
});
You can’t perform that action at this time.
0 commit comments