RequestInterceptor class

Interface to implements a request interceptor. Not recommended to modify body inside interceptor, see Converter to encode body request.

RequestInterceptor are call after Converter.convertRequest

See builtin interceptor CurlInterceptor, HttpLoggingInterceptor

class MyRequestInterceptor implements ResponseInterceptor {
  @override
  FutureOr<Request> onRequest(Request request) {
    return applyHeader(request, 'auth_token', 'Bearer $token');
  }
}
Implementers
Annotations

Constructors

RequestInterceptor()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onRequest(Request request) FutureOr<Request>
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited