HTTP Request

Summary

Perform an HTTP request.

Request method, url, body, and headers can be configured in Settings -> Parameters.

Ports

A request is made when an event is received on the in port.

The received event is routed to one of the output port.
If the request is successful, the event is routed to the success port. Otherwise it is routed to the fail port.

Input/Output Format

Input

Any object may be received on the in port.

Variable interpolation used in Settings -> Parameters may impose further assumptions.

Output

Success

The received event is routed as is, but with a response property attatched to the success port.

The response property has the following format:

{
    status,
    statusText,
    headers,
    data,
}

status is a number containing the HTTP response status code.
statusText is a string containing a status message from the server.
headers is object containing the response headers. A header may be accessed using bracket notation, e.g. headers['content-type'].
data: a value containing the response body.

Fail

The received event is routed as is, but with an err property attatched to the fail port. The value of the err property describes the error.

Events

This function does not listen for, nor emits any events.

Other

Responses are assumed to be JSON.