Module: executives/commons

Common functions used by several executives

Members

(static, constant) defaultHeaders

A doctionary of default headers.

These are the default headers that will be placed in the response if that is wrapped by the Ok..., or Empty... response functions.
type: {Object}

Methods

(static) wrapEmptyResponse(bodyProvider, cb)

Wraps an empty response without body.

Parameters:
Name Type Description
bodyProvider function | Object

If it is a Function, then it will be called to ensure that the operation is executed, but its result will not be used.

cb function

An error-first callback, that has to be called with the empty-body response object.

(static) wrapOkResponse(bodyProvider, cb)

Wraps the response body into a complete OK response object.

Parameters:
Name Type Description
bodyProvider function | Object

The body object of the response. If it is a Function, then it will be called, and its response will be used as response body.

cb function

An error-first callback, that has to be called with the complete response object.