File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,8 @@ class InterceptedClient extends BaseClient {
316316 Future <BaseRequest > _interceptRequest (BaseRequest request) async {
317317 BaseRequest interceptedRequest = request.copyWith ();
318318 for (InterceptorContract interceptor in interceptors) {
319- if (await interceptor.shouldInterceptRequest ()) {
319+ if (await interceptor.shouldInterceptRequest (
320+ request: interceptedRequest)) {
320321 interceptedRequest = await interceptor.interceptRequest (
321322 request: interceptedRequest,
322323 );
@@ -330,7 +331,8 @@ class InterceptedClient extends BaseClient {
330331 Future <BaseResponse > _interceptResponse (BaseResponse response) async {
331332 BaseResponse interceptedResponse = response;
332333 for (InterceptorContract interceptor in interceptors) {
333- if (await interceptor.shouldInterceptResponse ()) {
334+ if (await interceptor.shouldInterceptResponse (
335+ response: interceptedResponse)) {
334336 interceptedResponse = await interceptor.interceptResponse (
335337 response: interceptedResponse,
336338 );
Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ import 'package:http/http.dart';
2828///}
2929///```
3030abstract class InterceptorContract {
31- FutureOr <bool > shouldInterceptRequest () => true ;
31+ FutureOr <bool > shouldInterceptRequest ({ required BaseRequest request} ) => true ;
3232
3333 FutureOr <BaseRequest > interceptRequest ({required BaseRequest request});
3434
35- FutureOr <bool > shouldInterceptResponse () => true ;
35+ FutureOr <bool > shouldInterceptResponse ({ required BaseResponse response} ) => true ;
3636
3737 FutureOr <BaseResponse > interceptResponse ({required BaseResponse response});
3838}
You can’t perform that action at this time.
0 commit comments