A request defines a plain HTTP request.
| Name | Description | Accept variable | Required | Since |
|---|---|---|---|---|
| url | The URL to hit | ✓ | ✓ | |
| server | The server name to use | - | - | |
| method | The request method | - | - | |
| headers | The request header list | ✓ | - | |
| body | The request body | ✓ | - | |
| extractors | The extractor list | - | - | |
| assertions | The list of assertions to validate the response content | - | - | 7.6 |
| sla_profile | The name of the SLA profile to apply to the request | - | - | 6.9 |
Defining an HTTP request with a GET method.
request urlhttp//petstore.swagger.io80/v2/pet/findByStatus?status=availableDefining an HTTP request with a GET method and a SLA profile.
xxxxxxxxxxrequest urlhttp//petstore.swagger.io80/v2/pet/findByStatus?status=available sla_profileMySlaProfileDefine the URL of the HTTP request. A URL can be defined with an absolute URL or a relative URL. A relative URL requires the server field.
Use convention to define an URL: http[s]://{host}[:{port}][/{path}][?{query}]. Variables can be used from the host, port, path parameters and from the name/value pairs of the query parameter. To encode the evaluation of a variable from the name/value pairs of the query parameter, use convention: __encodeURL(${my_variable}).
Defining an HTTP request with an absolute URL.
xxxxxxxxxxrequest urlhttp//petstore.swagger.io80/v2/pet/findByStatus?status=availableDefining an HTTP request with a relative URL.
xxxxxxxxxxrequest url/v2/pet/findByStatus?status=available serverserver_petstoreDefining an HTTP request with an absolute URL in using some variables.
xxxxxxxxxxrequest urlhttp//$var_host$var_port/v2/pet/findByStatus?status=$var_status_valueDefining an HTTP request with an absolute URL in encoding the evaluation of a variable.
xxxxxxxxxxrequest url/v2/pet/findByStatus?status=__encodeURL($var_status_value) serverserver_petstoreDefine the request method to use to HTTP request.
The available values are:
GETPOSTHEADPUTDELETEOPTIONSTRACE{method-name} for CUSTOM caseThe default value is "GET".
Defining an HTTP request with a POST method.
xxxxxxxxxxrequest urlhttps//petstore.swagger.io/v2/pet methodPOST headersacceptapplication/jsonContent-Typeapplication/json body { "id": 0, "category": { "id": 0, "name": "string" }, "name": "doggie", "photoUrls": [ "string" ], "tags": [ { "id": 0, "name": "string" } ], "status": "available" } Define the name of the server to use for the HTTP request. The server field is required if a relative URL is defined in the url field.
Defining an HTTP request with a relative URL.
xxxxxxxxxxrequest url/v2/pet/findByStatus?status=available serverserver_petstoreDefine the headers to attach to the HTTP request with the following format:
headers:
header-name: header-value
The header-name parameter represents the header name. This parameter is required.
The header-value parameter represents the header value. This parameter can be optional and can use a variable.
Defining an HTTP request with a header.
request:
url: http://petstore.swagger.io:80/v2/pet/findByStatus?status=available
headers:
- accept: application/json
- Content-Type: ${var_content_type}
Define the request body to use for the HTTP request. Variables can be used in the request body.
In using the Content-Type header with application/x-www-form-urlencoded, the variables can be used from the name/value pairs of the request body. To encode the evaluation of a variable from the name/value pairs, use convention: __encodeURL(${my_variable}).
The bodies containing a binary or multipart/form-data data are not yet supported.
Defining an HTTP request with a JSon body in using some variables.
request:
url: https://petstore.swagger.io/v2/pet
method: POST
headers:
- accept: application/json
- Content-Type: application/json
body: |
{
"id": 0,
"category": {
"id": ${var_category_id},
"name": "${var_category_name}"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "${var_status}"
}
Defining an HTTP request with a Form body in using some variables.
request:
url: https://www.compagny.com/select?animal=dog
method: POST
headers:
- Content-Type: application/x-www-form-urlencoded
body: |
name=__encodeURL(${var_dog_name})&breed=__encodeURL(${var_dog_breed})