Interceptor class

An interceptor that can be used to modify requests / responses, handle errors, observe requests, etc.

Any exceptions thrown in an interceptor that is not a RhttpException will be caught and wrapped in a RhttpInterceptorException. To increase type safety, it is recommended to throw a (custom) subclass of RhttpException.

Constructors

Interceptor.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

afterResponse(HttpResponse response) Future<InterceptorResult<HttpResponse>>
Called before the response is returned.
beforeRequest(HttpRequest request) Future<InterceptorResult<HttpRequest>>
Called before the request is sent.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(RhttpException exception) Future<InterceptorResult<RhttpException>>
Called when an exception is thrown.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

next<T>([T? value]) InterceptorResult<T>
Continues to the next interceptor. If no value is provided, the current value is returned (no changes).
resolve<T>(HttpResponse response) InterceptorResult<T>
Stops the interceptor chain and resolve the request with a response.
stop<T>([T? value]) InterceptorResult<T>
Stops the interceptor chain. If no value is provided, the current value is returned (no changes).