Class: Request

Request()

new Request()

The Request object represents the request message that was sent to the server. This includes information about HTTP headers and the body of the HTTP request sent to the server.
For triggers, the request represents the operation that is executing when the trigger is run. For example, if the trigger is being run ("triggered") on the creation of a document, then
the request body contains the JSON body of the document to be created. This can be accessed through the request object and (as JSON) can be natively consumed in JavaScript.
For stored procedures, the request contains information about the request sent to execute the stored procedure.

Source:

Methods

getBody() → {string}

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

getOperationType() → {Create/Replace/Upsert/Delete}

Gets the OperationType for the request with a pre-trigger or post-trigger

Source:
Returns:
The value of the operation type corresponding to the current request.
Type
Create/Replace/Upsert/Delete

getValue(key) → {string}

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

setBody(value)

Sets the request body.
Note: this can be only used in a pre-trigger to overwrite the existing request body.
The overwritten request body will then be used in the operation associated with this pre-trigger.

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

setValue(key, value)

Sets a specified request 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: