Module: request

Module to extract data from the 'request' object.
Source:

Methods

(static) extractBodyKey(request, key) → {String}

Extracts the value of the specified body key from the supplied request object.
Parameters:
Name Type Description
request Object The request object sent with the client request.
key String The parameter to extract.
Source:
Throws:
if the key does not exist.
Type
Error
Returns:
the value of the key.
Type
String

(static) getCredentials(request) → {Object}

Extracts the username and password passed in the HTTP request.
Parameters:
Name Type Description
request Object The request object sent by the client.
Source:
Throws:
if the username and/or password are missing.
Type
Error
Returns:
An object with the supplied username and password.
Type
Object

(static) getHeader(request, header) → {String}

Extracts the specified parameter from the supplied request object.
Parameters:
Name Type Description
request Object The request object sent with the client request.
header String The header to extract.
Source:
Throws:
if the request header key does not exist.
Type
Error
Returns:
the value of the request header key.
Type
String

(static) getParameter(request, param) → {String}

Extracts the specified parameter from the supplied request object.
Parameters:
Name Type Description
request Object The request object sent with the client request.
param String The parameter to extract.
Source:
Throws:
if the parameter does not exist.
Type
Error
Returns:
the value of the parameter.
Type
String

(static) replaceHostname(request) → {Object}

Replaces the host URL in the data.
Parameters:
Name Type Description
request Object The data from the Google API call.
Source:
Returns:
The data with the correct URL.
Type
Object