Libraries
    Preparing search index...

    Per-request context object passed to every middleware and endpoint handler.

    Provides typed access to path/query parameters, headers, the request body, and the DI service provider for the current request scope.

    const middleware: Middleware = async (ctx, next) => {
    ctx.items.set('startTime', Date.now());
    await next();
    };
    Index

    Constructors

    Properties

    _queryParams?: Record<string, string>

    — overridable for testing

    headers: Record<string, string>
    items: Map<string, unknown> = ...
    method: string
    principal: unknown = undefined

    The authenticated principal for this request. Set by authentication middleware; typed as unknown at the RequestContext level — handlers receive a fully typed version via ActionContext.principal.

    request: IncomingMessage
    responded: boolean = false
    response: ServerResponse
    url: URL

    Accessors

    Methods

    • Read and buffer the raw request body. Result is cached after the first call.

      Returns Promise<Buffer<ArrayBufferLike>>