TestReqSettings: {
    body?: TestReqBody;
    cookies?: StringInputs;
    headers?: StringInputs;
    hostname?: string;
    method: HttpMethod;
    params?: StringInputs;
    searchParams?: MultiStringInputs;
    url: string;
}

Configuration for creating an HttpReq instance for testing purposes.

Allows you to construct a fully synthetic HTTP request by providing mock values for every request data source — path parameters, search parameters, headers, cookies, and body — along with optional validation schemas. This is the primary way to create an IHttpReq in unit tests without needing a real Web API Request object.

Type declaration

  • Optionalbody?: TestReqBody

    Mock request body, structured by content type.

    Use the discriminated union variants to specify JSON, URL-encoded form data, multipart form data (with optional file uploads), or a custom payload.

  • Optionalcookies?: StringInputs

    Mock cookie values.

  • Optionalheaders?: StringInputs

    Mock HTTP request headers.

  • Optionalhostname?: string
    "https://test.local"
    
  • method: HttpMethod
  • Optionalparams?: StringInputs

    Mock path parameters (e.g. { id: "42" } for a route like /users/:id).

  • OptionalsearchParams?: MultiStringInputs

    Mock query/search parameters (e.g. { page: "1", tags: ["a", "b"] }).

  • url: string

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"