Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FloofRequest

An object representing an incoming request. Any path parameters and query parameters are also exposed as properties of a FloofRequest. Path parameters take priority if a conflict arises with a query parameter.

Hierarchy

  • FloofRequest

Index

Properties

backing

backing: IncomingMessage

The backing IncomingMessage object wrapped by this FloofRequest.

code

code: number

The HTTP status code this request was made with.

method

method: HttpVerb

The HTTP verb this request was made with.

path

The original path as defined by the endpoint. Use FloofRequest#url to get the request with parameters interpolated.

rawUrl

rawUrl: string

The full URL this request was made to.

status

status: string

The HTTP status message this request's status code is associated with.

url

url: string

The path this request was made to with parameters included. Use FloofRequest#path to get the original endpoint's path.

Methods

body

  • body(): Promise<any>
  • Retrieves the message body.

    Returns Promise<any>

    A promise that resolves with the body, parsed as whatever type was specified.

cookie

  • cookie(key: string): string
  • Retrieves a cookie value.

    Parameters

    • key: string

      The key of the cookie value to retrieve.

    Returns string

    The cookie value associated with the given key, or null if none exists.

header

  • header(key: string): string
  • Retrieves a request header.

    Parameters

    • key: string

      The header to retrieve.

    Returns string

    The header value, or null if none exists.

param

  • param(key: string): any
  • Retrieves a path parameter.

    Parameters

    • key: string

      The parameter to retrieve.

    Returns any

    The parameter value, adapted to whatever type the parameter is specified as.

query

  • query(key: string): any
  • Retrieves a query parameter.

    Parameters

    • key: string

      The parameter to retrieve.

    Returns any

    The parameter value, adapted to whatever type the parameter is specified as.

Generated using TypeDoc