http client
http client
The http client binding receives inbound application streams and encodes each request as a network stream via HTTP/1.1 protocol. Note that the same network stream can be reused to encode multiple HTTP/1.1 requests.
Conditional routes based on http request headers are used to route these network streams to an exit binding.
http_client:
type: http
kind: client
options:
versions:
- h2
exit: tcp_clientConfiguration (* required)
options
object
The client specific options.
options:
overrides:
custom-text: custom-valueoptions.requests
arrayofobject
Options to configure typed validations for request fields.
requests[].content
enum[double,float,int32,int64,json,string],object
Enforce validation for the request content.
content.model*
enum[double,float,int32,int64,json,string]
A schema or type to validate the request content. Refer to the individual model docs for type specific implementation.
requests[].content-type
arrayofstring
Content type of the HTTP request.
requests[].headers
objectas map of namedenum[double,float,int32,int64,json,string],objectas map of namedobjectproperties
Enforce validation for request headers.
requests[].method
enum[GET,PUT,POST,DELETE,OPTIONS,HEAD,PATCH,TRACE]
HTTP request method.
requests[].params
object
Query parameters of the HTTP request.
params.path
objectas map of namedenum[double,float,int32,int64,json,string],objectas map of namedobjectproperties
Enforce validation for path
path.model*
enum[double,float,int32,int64,json,string]
A schema or type to validate the path content. Refer to the individual model docs for type specific implementation.
params.query
objectas map of namedenum[double,float,int32,int64,json,string],objectas map of namedobjectproperties
Enforce validation for query
query.model*
enum[double,float,int32,int64,json,string]
A schema or type to validate the query content. Refer to the individual model docs for type specific implementation.
requests[].path
string
URL path of the HTTP request.
requests[].responses
arrayofobject
Options to configure typed validations for response fields.
responses[].content
enum[double,float,int32,int64,json,string],object
Enforce validation for the response content.
content.model*
enum[double,float,int32,int64,json,string]
A schema or type to validate the response content. Refer to the individual model docs for type specific implementation.
responses[].content-type
arrayofstring
Content type of the HTTP response.
responses[].headers
objectas map of namedenum[double,float,int32,int64,json,string],objectas map of namedobjectproperties
Enforce validation for response headers.
headers:
my-header:
model: string
maxLength: 100headers.model*
enum[double,float,int32,int64,json,string]
A schema or type to validate the headers content. Refer to the individual model docs for type specific implementation.
responses[].status
integer,arrayofinteger
HTTP status code or codes for the response
options.versions
arrayofenum[http/1.1,h2] | Default:http/1.1,h2
Supported protocol versions.
options.overrides
objectas map of namedstringproperties
Request header overrides.
routes*
arrayofobject
Conditional http specific routes.
routes:
- when:
- headers:
":scheme": https
":authority": example.com:443
exit: echo_serverroutes[].guarded
objectas map of namedarrayofstring
List of roles required by each named guard to authorize this route.
routes:
- guarded:
my_guard:
- read:itemsroutes[].when
arrayofobject
List of conditions (any match) to match this route. Read more: When a route matches
routes:
- when:
- headers:
":scheme": https
":authority": example.com:443when[].headers
objectas map of namedstringproperties
Header name value pairs (all match).
routes[].with
object
HTTP parameters for matched route when http streams.
routes:
- with:
headers:
overrides:
":scheme": https
":authority": example.com:443with.headers
object
Options for headers when adapting a route.
headers.overrides
objectas map of namedstringproperties
HTTP header name value pairs overrides.
routes[].exit
string
Next binding when following this route.
routes:
- when:
...
exit: echo_serverexit
string
Default exit binding when no conditional routes are viable.
exit: echo_servertelemetry
object
Defines the desired telemetry for the binding.
telemetry.metrics
array
Telemetry metrics to track
telemetry:
metrics:
- stream.*
- http.*
