HttpRequest Configuration
The HttpRequest configuration specifies the details of each HTTP interaction with options for capturing responses, using payloads, and applying headers.
Key Attributes
- URL: The endpoint to which the request is sent.
- HTTP Method: Defines the type of request (e.g., GET, POST, PUT).
- Headers: Key-value pairs included in the request.
- Payload: Data sent with the request (e.g., JSON body).
- Version: HTTP version (e.g., 1.1, 2.0).
httpRequest:
url: https://api.example.com/resource
httpMethod: POST
headers:
Content-Type: application/json
payload:
type: Raw
raw: '{"key": "value"}'
httpVersion: 2.0
Transport Options
supportH2C: Enable HTTP/2 cleartext when backend supports it.downloadHtmlEmbeddedResources: Auto-download page sub-resources (images/css/js) for page-load realism.
Other Options
saveResponse: Saves the response to the disk. Do not use unless you really need it. This may have serious impact on the load test performance.
Response Capture
Capture responses to variables for later usage:
httpRequest:
capture:
to: VariableName
as: Json|QJson|String|QString|Xml|QXml|Csv|QCsv|Int|Double|Boolean
regex: "optional-regex"
makeGlobal: false
to: VariableName stores a session variable with .StatusCode, .StatusReason, .Headers.<Name>[i], .Body (supports JSONPath via ${VariableName.Body.field}).
Capture Details
The capture: property stores the full HTTP response into a built-in response variable type. The variable exposes:
- Body — the default value; typed by
as:(e.g.,Json,QJson,Xml,QXml,Csv,QCsv,String,QString). - StatusCode — numeric HTTP status code.
- StatusReason — HTTP reason phrase.
- Headers — header values; case-insensitive lookup; multiple values supported via index
[i].
Scope: Captured variables are session-scoped by default. Set makeGlobal: true to publish globally.
name: WebFlow
rounds:
- name: Auth
iterations:
- name: Login
httpRequest:
url: https://api.example.com/login
method: POST
payload:
type: Json
value: '{"user":"${U}","pass":"${P}"}'
capture:
to: LoginResponse
as: Json
makeGlobal: false
Access Patterns
- Body (typed):
${LoginResponse.Body}; JSON:${LoginResponse.Body.token}; XML:${LoginResponse.Body.Root.Element}; CSV:${LoginResponse.Body[0,2]} - Status/Reason:
${LoginResponse.StatusCode},${LoginResponse.StatusReason} - Headers:
${LoginResponse.Headers.Content-Type},${LoginResponse.Headers.Set-Cookie[0]}
Typical skipIf Usage
skipIf: ${LoginResponse.StatusCode} == 401
skipIf: ${LoginResponse.Body.token} == ""