@nexartis/nexartis-nanda-node-sdk - v1.2.1
    Preparing search index...

    Interface NnnHooks

    Lifecycle hooks for request/response interception.

    interface NnnHooks {
        afterResponse?: (
            url: string,
            response: Response,
            durationMs: number,
        ) => void | Promise<void>;
        beforeRequest?: (url: string, init: RequestInit) => void | Promise<void>;
        onError?: (url: string, error: unknown) => void | Promise<void>;
    }
    Index

    Properties

    afterResponse?: (
        url: string,
        response: Response,
        durationMs: number,
    ) => void | Promise<void>

    Called after every response (including 4xx/5xx). Fires before error handling. The response passed to this hook is a clone — reading its body will not affect the caller. However, avoid heavy body reads in hot paths.

    Note: For SSE (text/event-stream) responses this hook is intentionally skipped because response.clone() tees the underlying ReadableStream and, if the cloned branch is not fully consumed, buffers indefinitely for long-lived streams.

    beforeRequest?: (url: string, init: RequestInit) => void | Promise<void>

    Called before every request. Can inspect the URL and mutate init (e.g. headers).

    onError?: (url: string, error: unknown) => void | Promise<void>

    Called on request failure (after retries exhausted).