Request Module

Import

import request from 'request';

Represents the current HTTP request. The request includes the following properties:

  • _id (ObjectId) the request identifier

  • body (Object) the request body

  • client (Object)

    • _id (ObjectId) the app client identifier

    • key (String) the app client key used to perform the request

  • headers (Object) an object keyed by the request headers.

  • host (String) the hostname

  • params (Object) the parsed params from an api endpoint. (eg /routes/:foo -> req.params.foo)

  • path (String) the url path

  • query (Object) the parse http query portion of the request (eg /foo?bar=baz -> req.query.bar=='baz')

  • url (String) the original request url

Methods

getCookie(cookie) getHeader(header)

Get a cookie value.

Arguments

  • cookie (String) the cookie name.

Returns

  • value (String) the cookie value.

getHeader(header)

Gets a request header

Arguments

  • header (String) the name of the header.

Returns

  • value (String) the header value.

Last updated