An HttpRequest is stack allocated and only accessible during the callback invocation.

interface HttpRequest {
    forEach(cb): void;
    getCaseSensitiveMethod(): string;
    getHeader(lowerCaseKey): string;
    getMethod(): string;
    getParameter(index): string;
    getQuery(): string;
    getQuery(key): string;
    getUrl(): string;
    setYield(_yield): HttpRequest;
}

Methods

  • Loops over all headers.

    Parameters

    • cb: ((key, value) => void)
        • (key, value): void
        • Parameters

          • key: string
          • value: string

          Returns void

    Returns void

  • Returns the HTTP method as-is.

    Returns string

  • Returns the lowercased header value or empty string.

    Parameters

    Returns string

  • Returns the lowercased HTTP method, useful for "any" routes.

    Returns string

  • Returns the parsed parameter at index. Corresponds to route.

    Parameters

    • index: number

    Returns string

  • Returns the raw querystring (the part of URL after ? sign) or empty string.

    Returns string

  • Returns a decoded query parameter value or undefined.

    Parameters

    • key: string

    Returns string

  • Returns the URL including initial /slash

    Returns string

  • Setting yield to true is to say that this route handler did not handle the route, causing the router to continue looking for a matching route handler, or fail.

    Parameters

    • _yield: boolean

    Returns HttpRequest

Generated using TypeDoc