Request
The request
block creates and executes a request to a backend service.
📝 Multiple
proxy
andrequest
blocks are executed in parallel.
Block name | Context | Label |
---|---|---|
request | Endpoint Block | ⚠ A Proxy Block or Request Block w/o a label has an implicit label "default" . Only one Proxy Block or Request Block w/ label "default" per Endpoint Block is allowed. |
Attributes
Name | Type | Default | Description |
---|---|---|---|
backend | string | - | References a backend in definitions for the request. Mutually exclusive with |
body | string | - | Plain text request body, implicitly sets |
expected_status | tuple (int) | [] | If defined, the response status code will be verified against this list of codes. If the status code is not included in this list an |
form_body | string | - | Form request body, implicitly sets |
headers | object | - | Same as |
json_body | string | - | JSON request body, implicitly sets |
method | string | "GET" | The request method. |
query_params | object | - | Key/value pairs to set query parameters for this request. |
url | string | - | URL of the resource to request. May be relative to an origin specified in a referenced or nested |
If the url
attribute is specified and its value is an absolute URL, the protocol and host parts must be the same as in the value of the {origin} attribute of the used backend.
Nested Blocks
Name | Description |
---|---|
backend | Configures a backend for the request (zero or one). Mutually exclusive with |
Examples
request {
url = "https://httpbin.org/anything"
body = "foo"
}