Interface DispatchHandler

interface DispatchHandler {
    onBodySent?(chunk: Buffer): void;
    onRequestSent?(): void;
    onRequestStart?(controller: DispatchController, context: any): void;
    onRequestUpgrade?(
        controller: DispatchController,
        statusCode: number,
        headers: IncomingHttpHeaders,
        socket: Duplex,
    ): void;
    onResponseData?(controller: DispatchController, chunk: Buffer): void;
    onResponseEnd?(
        controller: DispatchController,
        trailers: IncomingHttpHeaders,
    ): void;
    onResponseError?(controller: DispatchController, error: Error): void;
    onResponseStart?(
        controller: DispatchController,
        statusCode: number,
        headers: IncomingHttpHeaders,
        statusMessage?: string,
    ): void;
    onResponseStarted?(): void;
}

Methods§

§

onBodySent?(chunk: Buffer): void

Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests

§

onRequestSent?(): void

Invoked after the request body is fully sent.

§

onRequestStart?(controller: DispatchController, context: any): void

§

onRequestUpgrade?(
    controller: DispatchController,
    statusCode: number,
    headers: IncomingHttpHeaders,
    socket: Duplex,
): void

§

onResponseData?(controller: DispatchController, chunk: Buffer): void

§

onResponseEnd?(
    controller: DispatchController,
    trailers: IncomingHttpHeaders,
): void

§

onResponseError?(controller: DispatchController, error: Error): void

§

onResponseStart?(
    controller: DispatchController,
    statusCode: number,
    headers: IncomingHttpHeaders,
    statusMessage?: string,
): void

§

onResponseStarted?(): void

Invoked when response is received, before headers have been read. *