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_client
Configuration (* required)
options
object
The client
specific options.
options:
overrides:
custom-text: custom-value
options.requests
array
ofobject
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
array
ofstring
Content type of the HTTP request.
requests[].headers
object
as map of namedenum
[double
,float
,int32
,int64
,json
,string
],object
as map of namedobject
properties
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
object
as map of namedenum
[double
,float
,int32
,int64
,json
,string
],object
as map of namedobject
properties
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
object
as map of namedenum
[double
,float
,int32
,int64
,json
,string
],object
as map of namedobject
properties
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
array
ofobject
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
array
ofstring
Content type of the HTTP response.
responses[].headers
object
as map of namedenum
[double
,float
,int32
,int64
,json
,string
],object
as map of namedobject
properties
Enforce validation for response headers.
headers:
my-header:
model: string
maxLength: 100
headers.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
,array
ofinteger
HTTP status code or codes for the response
options.versions
array
ofenum
[http/1.1
,h2
] | Default:http/1.1,h2
Supported protocol versions.
options.overrides
object
as map of namedstring
properties
Request header overrides.
routes*
array
ofobject
Conditional http
specific routes.
routes:
- when:
- headers:
":scheme": https
":authority": example.com:443
exit: echo_server
routes[].guarded
object
as map of namedarray
ofstring
List of roles required by each named guard to authorize this route.
routes:
- guarded:
my_guard:
- read:items
routes[].when
array
ofobject
List of conditions (any match) to match this route. Read more: When a route matches
routes:
- when:
- headers:
":scheme": https
":authority": example.com:443
when[].headers
object
as map of namedstring
properties
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:443
with.headers
object
Options for headers when adapting a route.
headers.overrides
object
as map of namedstring
properties
HTTP header name value pairs overrides.
routes[].exit
string
Next binding when following this route.
routes:
- when:
...
exit: echo_server
exit
string
Default exit binding when no conditional routes are viable.
exit: echo_server
telemetry
object
Defines the desired telemetry for the binding.
telemetry.metrics
array
Telemetry metrics to track
telemetry:
metrics:
- stream.*
- http.*