Arguments available to 'before' interceptors.

interface BeforeInterceptorData {
    context: Record<string | symbol, unknown>;
    options: InterceptorOptions;
    signal?: AbortSignal;
    target: URL;
}

Properties

context: Record<string | symbol, unknown>

The context object is a per-request object that is passed to all interceptors. It can be used to keep interceptor state for a request.

Use a sensible namespace string or a symbol to store state to avoid naming collisions.

Other request options (e.g. headers).

signal?: AbortSignal

AbortSignal for cancellation support.

target: URL

The current request's target URL, including query parameters. Can be modified to redirect the request to a different location.