HTTP Request
Overview
The HTTP Request Traffic Policy action makes a request against a third-party API and returns the response.
Configuration Reference
The Traffic Policy configuration reference for this action.
Supported Phases
on_tcp_connect
, on_http_request
, on_http_response
Type
http-request
Configuration Fields
urlstringRequiredCEL
The destination for the http request.
methodenum
The http request method.
- Possible enum values
GET
(default)PUT
POST
PATCH
DELETE
OPTIONS
query_paramslist of objectsCEL
headersobjectCEL
Map of header key to header value to be added.
bodystringCEL
The request body.
max_redirectsint
Maximum allowed redirects.
timeouttime
Maximum wait across all request attempts.
retry_conditionstringCEL
Accepts a cel expression that determines whether to retry the request.
on_errorenum
Whether or not further actions in the Traffic Policy should run if there is an error.
- Possible enum values
continue
(default)halt
Action Result Variables
The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.
actions.ngrok.http_request.error.codestring
actions.ngrok.http_request.error.messagestring
Message for an error that occurred during the invocation of an action.
actions.ngrok.http_request.attemptsarray of objects
A list of HTTP responses for each request attempt.
actions.ngrok.http_request.reqobject
The HTTP request.
actions.ngrok.http_request.resobject
The last attempted HTTP response. Unlike
actions.ngrok.attempts[i]
this variable also contains the response body.