Interceptors

Request

Implement RequestInterceptor class or define function with following signature FutureOr<Request> RequestInterceptorFunc(Request request)
Request interceptor are called just before sending request
1
final chopper = ChopperClient(
2
interceptors: [
3
(request) async => request.copyWith(body: {}),
4
]
5
);
Copied!

Response

Implement ResponseInterceptor class or define function with following signature FutureOr<Response> ResponseInterceptorFunc(Response response)
Called after successful or failed request
1
final chopper = ChopperClient(
2
interceptors: [
3
(Response response) async => response.replace(body: {}),
4
]
5
);
Copied!

Builtins

Last modified 4mo ago
Copy link