Skip to main content

HttpRequest

The HttpRequest action makes a HTTP(S) request to a user-specified URL. A user can set headers, method and body.

Inputs

  • url - a string (or function taking a context parameter) to the endpoint Porla should make the HTTP request.
  • headers - (optional) a Lua table of string keys and values that sets the HTTP request headers.
  • method - (optional) a string (or function taking a context parameter) with the HTTP method to use.
  • body - (optional) a string (or function taking a context parameter) with the HTTP request body.

Outputs

  • content - the HTTP response body.
  • status_code - the HTTP response status code.

Usage

local HttpRequest = require "porla.actions.HttpRequest"

Example

HttpRequest:new{
url = "https://some-where.example.com/v1/thing",
headers = {
["Content-Type"] = "application/json",
["X-API-Key"] = "<some API key>"
},
method = "PUT",
body = "{}"
}