Sanity Library Reference Docs
    Preparing search index...

    Type Alias RequestHandler

    RequestHandler: (
        request: RequestHandlerOptions,
        next: (request: RequestHandlerOptions) => Promise<unknown>,
    ) => Promise<unknown>

    Intercepts a client request around the normal HTTP pipeline.

    Call next(request) to execute the request. It resolves to the parsed response body and rejects with the same errors the client normally exposes, including ClientError and ServerError. A handler can modify the request, retry it by calling next again, or return a synthetic body.

    Browser asset uploads and server-sent event connections do not use this handler.

    Type declaration