The default implementation of IHttpReq.

Provides typed access to all request data sources — JSON body, form fields, path parameters, query parameters, headers, and the raw body.

Use HttpReq.fromWebReq to create an instance from a standard Web API Request object.

The HTTP method type.

The type of the parsed JSON body.

The type of the parsed form fields.

The type of the parsed path parameters.

The type of the parsed query parameters.

The type of the parsed headers.

The expected file upload definitions.

A record mapping cookie names to their value types.

IMPORT_PATH: "@daiso-tech/core/http-router"

Implements

Accessors

  • get readableStream(): null | ReadableStream<unknown>
  • The request body as a ReadableStream, or null if the body has already is not available (e.g. GET/HEAD requests).

    Allows streaming the body in chunks via the Streams API.

    Returns null | ReadableStream<unknown>

  • get signal(): AbortSignal
  • An AbortSignal that is aborted when the underlying request is cancelled or times out.

    Handlers can listen to this signal to stop long-running work early when the client disconnects or the request reaches its deadline.

    Returns AbortSignal

Methods

  • Returns the raw, parsed cookies as a string-to-string map.

    Returns Partial<Record<string, string>>

  • Returns the raw unparsed headers, or empty object if not present.

    Returns Partial<Record<string, string>>

  • Returns the raw unparsed path parameters, or empty object if not present.

    Returns Partial<Record<string, string>>

  • Returns the raw unparsed query parameters, or empty object if not present.

    Returns Partial<Record<string, string | string[]>>

  • Creates an HttpReq instance with synthetic data for testing.

    Unlike HttpReq.fromWebReq, this method does not require a real Web API Request object. Instead, you provide mock values for path parameters, search parameters, headers, cookies, and body through TestReqSettings. The resulting HttpReq behaves identically to one created from a real request, including validation support.

    Parameters

    • settings: TestReqSettings

      Configuration for the test request, including mock data and optional validation schemas.

    Returns IHttpReq

    A new IHttpReq instance suitable for testing.