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 11# Changelog
22
3+ ## 2.0.0-beta.4
4+
5+ - ❗️🛠  ;  ; Changed: ` shouldAttemptRetryOnException ` will now also pass the ` BaseRequest ` .
6+ - 🚦  ;  ; Tests: Updated tests.
7+
38## 2.0.0-beta.3
49
510- 🐞  ;  ; 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 {
355355 int get maxRetryAttempts => 2 ;
356356
357357 @override
358- bool shouldAttemptRetryOnException (Exception reason) {
358+ bool shouldAttemptRetryOnException (Exception reason, BaseRequest request ) {
359359 log (reason.toString ());
360360
361361 return false ;
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ class InterceptedClient extends BaseClient {
278278 } on Exception catch (error) {
279279 if (retryPolicy != null &&
280280 retryPolicy! .maxRetryAttempts > _retryCount &&
281- retryPolicy! .shouldAttemptRetryOnException (error)) {
281+ retryPolicy! .shouldAttemptRetryOnException (error, request )) {
282282 _retryCount += 1 ;
283283 return _attemptRequest (request);
284284 } else {
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ import 'package:http/http.dart';
3636abstract class RetryPolicy {
3737 /// Defines whether the request should be retried when an Exception occurs
3838 /// while making said request to the server.
39- bool shouldAttemptRetryOnException (Exception reason) => false ;
39+ bool shouldAttemptRetryOnException (Exception reason, BaseRequest request) =>
40+ false ;
4041
4142 /// Defines whether the request should be retried after the request has
4243 /// received `response` from the server.
Original file line number Diff line number Diff line change 11name : http_interceptor
22description : 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
44homepage : https://github.com/CodingAleCR/http_interceptor
55issue_tracker : https://github.com/CodingAleCR/http_interceptor/issues
66repository : https://github.com/CodingAleCR/http_interceptor
Original file line number Diff line number Diff line change @@ -17,8 +17,13 @@ main() {
1717 group ("shouldAttemptRetryOnException" , () {
1818 test ("returns false by default" , () {
1919 expect (
20- testObject
21- .shouldAttemptRetryOnException (Exception ("Test Exception." )),
20+ testObject.shouldAttemptRetryOnException (
21+ Exception ("Test Exception." ),
22+ Request (
23+ 'GET' ,
24+ Uri (),
25+ ),
26+ ),
2227 false );
2328 });
2429 });
You can’t perform that action at this time.
0 commit comments