http
The http fn posts inputs as requests to an http endpoint.
The http fn is useful for creating event triggers for other functions, especially ones used with an autoscaling technology. If the http endpoint returns a 200- or 300-level response, the fn treats it as a successful call and returns the body of the repsonse as output. Otherwise, it treats the call as a failure and returns the body of the response in an error.
fnrunner Key
fnrun.fn/http
Configuration
Key | Type | Default | Description |
---|---|---|---|
targetURL | String | "" | The url to which requests will be posted |
contentType | String | application/json | The content-type sent with the request |
Examples
The following example creates a system that receives messages from AWS SQS and posts them to another http endpoint.
source:
fnrun.source/sqs:
queue: my-queue
middleware:
- fnrun.middleware/key: body
fn:
fnrun.fn/http:
targetURL: http://example.com/some-endpoint