The request, passed as argument to endpoint functions.

interface Request<T extends JsonCompatible<T> = any> {
    body: Body<T>;
    caller?: AuthnIdentity;
    headers: { [key: string]: string };
    hostname: string;
    method: string;
    params: { [key: string]: string };
    path: string;
    query: string;
    route: string;
    url: string;
}

Type Parameters

Properties

body: Body<T>

An object to access the request body in various ways.

caller?: AuthnIdentity

An object describing the authenticated identity retrieved by the endpoint's authentication policies, or undefined if no policy is defined for the endpoint.

headers: { [key: string]: string }

An object mapping lower-case HTTP header names to their values.

hostname: string

Hostname extracted from Host header, or null if header is missing

method: string

The HTTP method of the request.

For example GET /app/person/bob?fields=all becomes "GET"

params: { [key: string]: string }

An object mapping URL path parameter names to their values.

For example GET /app/person/bob?fields=all matched to /app/person/{name} becomes {"name": "bob"}

path: string

The path component of the requested URL.

For example GET /app/person/bob?fields=all becomes "/app/person/bob"

query: string

The query component of the requested URL.

For example GET /app/person/bob?fields=all becomes "fields=all"

route: string

The endpoint name which matched requested URL, potentially containing path parameters.

For example GET /app/person/bob?fields=all becomes "/app/person/{name}"

url: string

The full original requested URL.

For example GET /app/person/bob?fields=all becomes "/app/person/bob?fields=all"