HTTP
Supported test-directives
Qapir
supports HTTP and enables you to test RESTful HTTP json-based APIs. The supported directives are:
expected_http_status
of typenumber
- verifies that response has expected HTTP-statusheaders
of typemap[string]string
- lets you pass a set of header to your HTTP-requestquery_params
of typemap[string]string
- lets you pass a set of query-paramemters to your HTTP-requestbody
of typestring
- lets you pass a request-body to your HTTP-requestmethod
of typestring
- an HTTP-method, one of[GET, POST, PUT, PATCH, DELETE, OPTIONS]
QTL-directives
- Extracting a value by jsonpath from response-body. This example looks for field with jsonpath
$.path.to.attribute
and saves its value as${var.attribute}
SELECT
$.path.to.attribute AS ${var.attribute}
FROM
${response.body};
- Extracting a header-value. This example looks for header with name
Custom-Header
and saves its value as${var.header}
SELECT
Custom-Header AS ${var.header}
FROM
${response.headers};
Examples
Please, check out related examples in the official GitHub repo: https://github.com/vrtxlabs/qapir/blob/main/.qapir/tests/jsonpath_test.yml