beakr (version 0.3.1)

Request: Request Class

Description

A Request object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res).

Arguments

Fields

parameters

A list containing properties mapped to the named router parameters.

headers

A list of response headers.

path

Contains the path part of the request URL.

method

Contains a string corresponding to the HTTP method of the request: GET, POST, PUT, and so on.

raw

Returns the raw request (req) object.

type

Contains the body content-type, i.e. "text/html" or "application/json".

body

Contains the data submitted in the request body.

protocol

Contains the request protocol string.

Methods

attach(key, value)

Returns a key-value.

getHeader(key)

Returns the key element of the headers list.

setHeader(key, value)

Attaches a header to headers list.

addParameters(named_list)

Adds parameters to the named key-value parameters list.

intialize(req)

Creates a new Request object by parsing and extracting features of req input and populating the object fields.

Methods

Public methods

Method attach()

Usage

Request$attach(key, value)

Method getHeader()

Usage

Request$getHeader(key)

Method setHeader()

Usage

Request$setHeader(key, value)

Method addParameters()

Usage

Request$addParameters(named_list)

Method new()

Usage

Request$new(req)

Method clone()

The objects of this class are cloneable with this method.

Usage

Request$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

Response