Actions¶
The following methods are available as actions: http.connect,
http.delete, http.get, http.head, http.options,
http.patch, http.post, http.put and http.trace.
Basics¶
Query
Query parameters can be passed using the params field.
title: Make request with query parameters
description: Send query parameters by HTTP GET
action: http.get
url: https://httpbin.org/get
params:
test: 'true'
Query parameters are automatically encoded and appended to the URL.
Data
The data field allows sending raw request bodies as str or bytes.
title: Make request with data
description: Send JSON by HTTP POST
action: http.post
url: https://httpbin.org/post
headers:
content-type: application/json
data: '{"message": "hello", "test": true}'
The raw body is preserved in the response model as:
request.bodyas bytesrequest.textas text
Files
Multipart file uploads are supported via the files field.
Each file entry defines:
name- form field namecontent- string or bytesfilename(optional)mimetype(optional)
If mimetype is not provided, it is inferred:
application/octet-streamfor bytestext/plainfor strings
Binary file
title: Make request with binary file
description: >
1. Get binary data from hex
2. Send binary attachment by HTTP POST
action: http.post
url: https://httpbin.org/post
files:
- name: test
content: !binaryHex |
48 65 6C 6C 6F 2C 20
57 6F 72 6C 64 21
Text file
title: Make request with text file
description: >
1. Get text data from file
2. Send text attachment by HTTP POST
action: http.post
url: https://httpbin.org/post
files:
- name: test
content: !textFile example.txt
Inputs¶
Input schemas
All methods share an identical base parameter structure, differing
only in the allowed values for the action field and the specifics
of request body processing. The structure below is shown for one action,
but it serves as a reference for all other HTTP actions.
Action schema
- action schemas.http.HttpGet¶
- param action: Literal['http.get'] [Required]¶
- param data: bytes | str | None | Deferred = None¶
Optional request payload as raw bytes or string.
- param description: str | None = None¶
Detailed human-readable description of the DSL element.
- param expect: list[Check] = []¶
List of checks that must pass after the action execution.
Each check validates some aspect of the action result or side effects. All expectations are evaluated to determine the success or failure of the step.
- param export: dict[str, Deferred[Value]] = {}¶
Mapping of variable names to values derived from the action result.
Exported variables are merged into the execution context and become available to subsequent steps.
- param headers: dict[str, Deferred[Value]] | None = None¶
Optional HTTP headers to include in the request.
- param output: str = 'result'¶
Name of the variable under which the action result context will be stored.
The stored value may later be referenced or selectively exported into the execution context.
- param params: dict[str, Deferred[Value]] | None = None¶
URL query parameters appended to the request.
Aliases:
params,queryandqueryParams
- param session: str | Deferred = 'default'¶
Logical name of the HTTP session to use.
- param spec: Literal['step'] = 'step'¶
- param timeout: int | float | None | Deferred = None¶
Response timeout.
- param title: str | None = None¶
Short human-readable title of the DSL element.
- param url: HttpUrl | Deferred [Required]¶
Target URL for the HTTP request.
- param vars: dict[str, Deferred[Value]] = {}¶
Local context variables provided to block.
These variables are added to the execution context and can be referenced by subsequent steps.
- param verify: bool | Path | Deferred = True¶
SSL verification setting.
Can be a boolean or a path to a CA bundle file.
Aliases:
verify,sslVerifyandcaBundle
Nested schemas
Files represented as nested structured objects with name and
content fields.
- object schemas.http.File¶
Structured representation of a multipart file field.
- field content: str | bytes [Required]¶
The file content as text or raw bytes.
- field filename: str | None = None¶
Optional filename reported in the multipart payload.
- field mimetype: str | None = None¶
Optional MIME type of the file (e.g., text/plain).
- field name: str [Required]¶
The multipart form field name for the file.
Outputs¶
Output schemas
Every method generates a Response
object at the output.
Response fields include:
status- HTTP statusheaders- normalized response headers (lowercase keys)cookies- list of structured cookiesbody- raw response body (bytes)text- response body as textrequest- structured original requesthistory- redirect chain (list of responses)
- object schemas.http.Response¶
Structured representation of an HTTP response.
- field body: bytes | None = None¶
The raw response body as bytes.
- field headers: dict[str, str] = {}¶
Response headers normalized to lowercase keys.
- field status: HTTPStatus [Required]¶
The HTTP status code of the response.
- field text: str | None = None¶
The raw response body as text.
Redirect history can be inspected:
title: Test redirects history
description: >
This test verifies that a GET request to the /redirect-to endpoint with a URL
parameter that points to a /status/204 endpoint returns a status code of 204
and that the response history includes a redirect with a status code of 302.
action: http.get
url: !urljoin baseUrl /redirect-to
params:
url: !urljoin baseUrl /status/204
headers:
accept: application/json
output: response
expect:
- title: Status is 204
value: !var response.status
match: 204
- title: History is not empty
value: !var response.history
notEqual: []
- title: Status of redirect response is 302
value: !var response.history.0.status
match: 302
Nested schemas
The original HTTP request is provided as a nested object.
- object schemas.http.Request¶
Structured representation of an HTTP request.
- field body: bytes | None = None¶
The raw request body as bytes.
- field headers: dict[str, str] = {}¶
Request headers normalized to lowercase keys.
- field method: HTTPMethod [Required]¶
The HTTP method of the request.
- field text: str | None = None¶
The raw request body as text.
- field urlString: HttpUrl [Required]¶
The full request URL as a validated HttpUrl.
Cookies from the response are provided as nested structured objects with secret values.
- object schemas.http.Cookie¶
Structured representation of an HTTP cookie.
- field comment: str | None = None¶
Optional comment associated with the cookie.
- field commentUrl: str | None = None¶
URL providing additional information about the cookie.
- field discard: bool = False¶
Indicates whether the cookie should be discarded at session end.
- field domain: str | None = None¶
The domain for which the cookie is valid.
- field expires: datetime | None = None¶
The expiration time of the cookie as a datetime object.
- field name: str [Required]¶
The name of the cookie.
- field path: str | None = None¶
The URL path for which the cookie is valid.
- field port: int | None = None¶
The port for which the cookie is valid.
- field rest: dict[str, Any] = {}¶
Additional non-standard cookie attributes.
- field secure: bool = False¶
Indicates whether the cookie is restricted to HTTPS.
- field value: SecretStr | None = None¶
The value of the cookie. Stored as a secret string.
- field version: int | None = None¶
The cookie specification version.
The parsed URL is provided as a nested structure, broken down into its components.
- object schemas.http.Url¶
Structured representation of an HTTP URL.
- field fragment: str | None = None¶
The fragment identifier of the URL.
- field host: str | None = None¶
The host component of the URL.
- field password: SecretStr | None = None¶
The password component of the URL, stored as secret.
- field path: str [Required]¶
The path component of the URL.
- field port: int | None = None¶
The network port of the URL.
- field query: dict[str, Any] = {}¶
Parsed query parameters as a dictionary.
- field query_string: str | None = None¶
The raw query string portion of the URL.
- field scheme: Literal['http', 'https'] [Required]¶
The URL scheme (http or https).
- field user: str | None = None¶
The username component of the URL, if present.
Examples¶
HTTP GET
This scenario demonstrates a basic http.get action. It performs an HTTP GET
request to a URL formed by joining a base URL with the /get path. The request
includes a custom accept header and query parameter test. After execution, the
result is stored in the response variable. Finally, two expectations are validated:
the HTTP status code must be 200, and the response body must contain a specific
echo message verified via a multiline regular expression.
title: Test GET
description: >
This test verifies that a GET request to the /get endpoint returns a status
code of 200 and that the response contains the correct URL from the request.
action: http.get
url: !urljoin baseUrl /get
headers:
accept: application/json
output: response
expect:
- title: Status is 200
value: !var response.status
match: 200
- title: Response contains request URL
description: >
The response should include the URL that was requested, confirming that
the server received the correct request and is returning the expected
data in the response.
value: !load
format: json
source: !var response.text
select: $.url
match: https://httpbin.org/get
HTTP POST with files
This scenario demonstrates an http.post action with a multipart file upload.
It performs an HTTP POST request to a dynamically constructed URL. The request includes
a custom accept header and a text file named test with the content Hello, World!.
The action output is stored in the response variable. Finally, the scenario validates
that the server returned a 200 status and that the response body contains the uploaded
file data, verified via a multiline regular expression.
title: Test POST with text file
description: >
This test verifies that a POST request to the /post endpoint with a text file
returns a status code of 200 and that the response contains the correct file
content that was sent in the request.
action: http.post
url: !urljoin baseUrl /post
headers:
accept: application/json
files:
- name: test
content: Hello, World!
output: response
expect:
- title: Status is 200
value: !var response.status
match: 200
- title: Body was sent
description: >
The response should include the content of the file that was sent in the
request, confirming that the server received the file correctly and is
returning the expected data in the response.
value: !load
format: json
source: !var response.text
select: $.files
match:
test: Hello, World!
HTTP PATCH with JSON
This scenario demonstrates an http.patch action with a JSON payload.
It performs an HTTP PATCH request with a dynamically constructed URL. The request includes
a structured JSON body generated from a source object via the !dump instruction.
After execution, the response text is parsed back into a JSON object using the !load
instruction and exported as the responseMessage variable. The scenario concludes
by validating a 200 status and performing a partial match to verify that the sent data
was correctly processed by the server.
title: Test PATCH with JSON content
description: >
This test verifies that a PATCH request to the /patch endpoint with JSON content
returns a status code of 200 and that the response contains the correct JSON
data that was sent in the request.
vars:
requestData: !dump
format: json
source:
name: Molecule Man
age: 29
secretIdentity: Dan Jukes
powers:
- Radiation resistance
- Turning tiny
- Radiation blast
action: http.patch
url: !urljoin baseUrl /patch
headers:
accept: application/json
content-type: application/json
data: !var requestData
output: response
expect:
- title: Status is 200
value: !var response.status
match: 200
- title: Body was sent
description: >
The response should include the JSON data that was sent in the request, confirming
that the server received the correct data and is returning the expected
information in the response.
value: !load
format: json
source: !var response.text
select: $.json
partialMatch: yes
match:
name: Molecule Man
age: 29