Class: Response

Response()

new Response()

The Response object represents the response message that will be sent from the server in response to the requested operation. This includes information about the HTTP headers and body of the response from the server.
The Response object is not present in pre-triggers because they are run before the response is generated.
For post-triggers, the response represents the operation that was executed before the trigger. For example, if the post-trigger is being run ("triggered") after the creation of a document, then
the response body contains the JSON body of the document that was created. This can be accessed through the response object and (as JSON) can be natively consumed in JavaScript.
For stored procedures, the response can be manipulated to send output back to the client-side.

Note: this object not available in pre-triggers

Source:

Methods

getBody() → {string}

Gets the response body.
Source:
Returns:
The response body.
Type
string

getMaxResourceQuota() → {string}

Gets a maximum quota allowed for the resource associated with a post-trigger
Note: this method is only available in post-triggers

Source:
Returns:
The value of the maximum allowed quota usage.
Type
string

getResourceQuotaCurrentUsage() → {string}

Gets a current quota usage for the resource associated with a post-trigger
Note: this method is only available in post-triggers

Source:
Returns:
The value of the current quota usage.
Type
string

getValue(key) → {string}

Gets a specified response header value.
Parameters:
Name Type Description
key string the name of the header to retrieve
Source:
Returns:
The value of the response header.
Type
string

setBody(value)

Sets the response body.
Note: This cannot be done in pre-triggers.
In post-triggers, the response body is already set with the requested resource and will be overwritten with this call.
In stored procedures, this call can be used to set the response message body as output to the calling client.

Parameters:
Name Type Description
value string the value to set in the response body
Source:

setValue(key, value)

Sets a specified response header value.
Note: this method cannot be used to create new headers.

Parameters:
Name Type Description
key string the name of the header
value string the value of the header
Source: