Beignet API reference
    Preparing search index...

    Type Alias AfterSendHook<Ctx, C>

    AfterSendHook: (
        args: {
            body?: InferBody<C>;
            contract: C;
            ctx?: Ctx;
            durationMs: number;
            error?: unknown;
            headers?: InferHeaders<C>;
            path?: InferPath<C>;
            query?: InferQuery<C>;
            req: HttpRequestLike;
            requestInfo: TrustedRequestInfo;
            response: HttpResponseLike;
            stages: RequestStageTimings;
        },
    ) => MaybePromise<void>

    Hook that runs after the response has been prepared.

    This is for logging and observability. Errors thrown by afterSend hooks are ignored by the server pipeline. ctx is absent for router-generated 404/405 responses, early hook responses, and failures before context creation.

    Type Parameters

    Type Declaration