# write-http

For each event, make an HTTP request. The request body will be defined as:

  1. Empty when request().method is not one of: POST, PUT, PATCH, or
  2. event.payload when defined, or
  3. JSON(event) otherwise

# Config

Required:

  • request: Function that returns request options:
    • method: HTTP method (GET, POST, DELETE, PUT, PATCH)
    • url: Target HTTP endpoint
    • headers: HTTP headers

Optional:

# Example

pipeline:
  write-http:
    config:
      request: !!js/function >-
        function (event) {}
          return {
            method: 'PUT',
            url: `http://localhost:1337/user/${event.id}?tag=foo&tag=bar`,
            headers: {
              'user-agent': 'my-agent/1.0',
            },
          }
        }