Docs
API 1.39
Status
Actions

capture_response

The `capture_response` step.

Waits for a network response matching url (and method), observed since the step started, and stores its parsed JSON body in a variable. Bodies are limited to 2 MB.

Type: object

#Keys

KeyTypeDescription
capture_response.intostringThe variable that receives the value, written vars.<name>.
capture_response.jsonstringA JSONPath into the response body; the result is stored instead of the whole body.
capture_response.methodstringThe HTTP method the response's request must have, such as GET or POST. Without it, any method matches.
capture_response.timeout_msintegerHow long to wait for the response in milliseconds, up to 120000. Defaults to 15000.
capture_response.urlstringA glob the response URL must match, such as **/api/orders*. An invalid glob is lint E009.

Every step also takes the common step keys: expect, id, if, name, on_error, optional, retry, side_effect, timeout_ms, x_kaab.

#Example

{
  "capture_response": {
    "url": "**/api/products*",
    "method": "GET",
    "json": "$.items[*].price",
    "into": "vars.prices",
    "timeout_ms": 15000
  }
}

From the contract fixture capture-response, a program the test suite validates.

Was this page helpful?