Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 973 Bytes

interceptors.md

File metadata and controls

37 lines (26 loc) · 973 Bytes

Interceptors

Request

Implement RequestInterceptor class or define function with following signature FutureOr<Request> RequestInterceptorFunc(Request request)

Request interceptor are called just before sending request

final chopper = new ChopperClient(
   interceptors: [
     (request) async => request.copyWith(body: {}),
   ]
);

Response

Implement ResponseInterceptor class or define function with following signature FutureOr<Response> ResponseInterceptorFunc(Response response)

{% hint style="info" %} Called after successful or failed request {% endhint %}

final chopper = new ChopperClient(
   interceptors: [
     (Response response) async => response.replace(body: {}),
   ]
);

Builtins