Skip to main content

InterceptorManager<T> Class

Axios.Net › AxiosNet.Interceptors

An ordered chain of interceptors: register one with Use, remove it with Eject or Clear.

public sealed class InterceptorManager<T>

Type parameters​

T

What the chain transforms: the request config or the response.

Inheritance System.Object → InterceptorManager<T>

Methods​

InterceptorManager<T>.Clear() Method​

Removes every interceptor of this chain.

public void Clear();

InterceptorManager<T>.Eject(int) Method​

Removes one interceptor. Unknown or already ejected ids are ignored.

public void Eject(int id);

Parameters​

id System.Int32

InterceptorManager<T>.Use(Func<T,Task<T>>, Func<Exception,Task<T>>, InterceptorOptions) Method​

Registers an interceptor and returns its id for Eject(int). onRejected receives the current error and returns a value to recover, or throws to keep the error flowing.

public int Use(System.Func<T,System.Threading.Tasks.Task<T>>? onFulfilled, System.Func<System.Exception,System.Threading.Tasks.Task<T>>? onRejected=null, AxiosNet.Interceptors.InterceptorOptions? options=null);

Parameters​

onFulfilled System.Func<T,System.Threading.Tasks.Task<T>>

onRejected System.Func<System.Exception,System.Threading.Tasks.Task<T>>

options InterceptorOptions

Returns​

System.Int32

InterceptorManager<T>.Use(Func<T,T>, Func<Exception,T>, InterceptorOptions) Method​

Synchronous variant of Use(Func<T,Task<T>>, Func<Exception,Task<T>>, InterceptorOptions).

public int Use(System.Func<T,T> onFulfilled, System.Func<System.Exception,T>? onRejected=null, AxiosNet.Interceptors.InterceptorOptions? options=null);

Parameters​

onFulfilled System.Func<T,T>

onRejected System.Func<System.Exception,T>

options InterceptorOptions

Returns​

System.Int32