method RpcInterceptorStore.prototype.consult
RpcInterceptorStore.prototype.consult(request: Request): Promise<Response | null>

Calls the installed handler. Returns the handler's response if it returns a Response, otherwise returns null.

A throwing handler is converted to a safe 500 Response rather than allowing the error to escape: an application bug in the handler must not take down the serve loop.

Consult exactly ONCE per request. The request is passed through undisturbed and the caller goes on to map that same Request for the Hono pipeline, so a handler returning null must not have read the body — see RpcFetchHandler. Consulting twice would break that for any body-inspecting handler even if each individual call honored the contract.

Parameters

request: Request

The native, undisturbed request

Return Type

Promise<Response | null>

The response, or null to fall through

Usage

import { RpcInterceptorStore } from "runtime/src/index.ts";