kinetex - v1.0.0-rc.1
    Preparing search index...

    Class InterceptorManager

    Manages registration, ejection, and pipeline execution of interceptors.

    Interceptors are executed in priority order (lowest first) through three phases: request (outbound), response (inbound), and error (recovery).

    Index

    Constructors

    Accessors

    • get requestCount(): number

      Number of registered request interceptors.

      Returns number

    • get responseCount(): number

      Number of registered response interceptors.

      Returns number

    Methods

    • Register a request interceptor.

      Parameters

      • fn: RequestInterceptorFn

        Interceptor function

      • opts: InterceptorOptions = {}

        Registration options (id, priority, once, condition)

      Returns string

      The interceptor ID (auto-generated or from opts.id)

    • Register a response interceptor.

      Parameters

      • fn: ResponseInterceptorFn

        Interceptor function

      • opts: InterceptorOptions = {}

        Registration options (id, priority, once, condition)

      Returns string

      The interceptor ID (auto-generated or from opts.id)

    • Register an error interceptor.

      Parameters

      • fn: ErrorInterceptorFn

        Interceptor function

      • opts: InterceptorOptions = {}

        Registration options (id, priority, once, condition)

      Returns string

      The interceptor ID (auto-generated or from opts.id)

    • Register both request and response interceptors together.

      Parameters

      • requestFn: RequestInterceptorFn | null
      • responseFn: ResponseInterceptorFn | null
      • opts: InterceptorOptions = {}

      Returns { requestId: string | null; responseId: string | null }

      • requestId: string | null

        ID of the registered request interceptor, or null

      • responseId: string | null

        ID of the registered response interceptor, or null

    • Eject (remove) an interceptor by ID.

      Parameters

      • id: string

        The interceptor ID returned from registration

      Returns boolean

      true if an interceptor was found and removed

    • Check if an interceptor with the given ID is registered.

      Parameters

      • id: string

      Returns boolean

    • Execute the full interceptor pipeline for a single request.

      Parameters

      • request: InterceptorRequest

        Initial request to send

      • dispatcher: Dispatcher

        The function that performs the actual HTTP fetch

      Returns Promise<InterceptorResponse>

      The final response after all interceptors have run

    • Internal: run (or re-run on retry) the full pipeline.

      Parameters

      • ctx: InterceptorContext
      • dispatcher: Dispatcher

      Returns Promise<InterceptorResponse>