write-http
For each event, evaluate a JavaScript request function and make the resulting HTTP call.
The request body is:
event.payload(string) when present, or- the full event serialised as JSON otherwise
Config
Required:
request: A JavaScript arrow function (or function expression) as a string. Receives the event object, must return{ url, method?, headers? }.url(required): Target HTTP endpointmethod: HTTP method — defaultPOSTheaders: Object of additional HTTP headers
Example
pipeline:
write-http:
module: write-http
inputs: [format-json]
config:
request: "event => ({ method: 'PUT', url: 'http://localhost:1337/user/' + event.id, headers: { 'user-agent': 'my-agent/1.0' } })"