@@ -18,33 +18,35 @@ Getting data from the request
1818
1919Currently, you can get the following data from request to the response via templating:
2020
21- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
22- | Field | Example | Request | Result |
23- +==============================+=================================================+==============================================+================+
24- | Request scheme | ``{{ Request.Scheme }} `` | http://www.foo.com | http |
25- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
26- | Query parameter value | ``{{ Request.QueryParam.myParam }} `` | http://www.foo.com?myParam=bar | bar |
27- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
28- | Query parameter value (list) | ``{{ Request.QueryParam.NameOfParameter.[1] }}``| http://www.foo.com?myParam=bar1&myParam=bar2 | bar2 |
29- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
30- | Path parameter value | ``{{ Request.Path.[1] }} `` | http://www.foo.com/zero/one/two | one |
31- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
32- | Method | ``{{ Request.Method }} `` | http://www.foo.com/zero/one/two | GET |
33- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
34- | Host | ``{{ Request.Host }} `` | http://www.foo.com/zero/one/two | www.foo.com |
35- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
36- | jsonpath on body | ``{{ Request.Body 'jsonpath' '$.id' }} `` | { "id": 123, "username": "hoverfly" } | 123 |
37- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
38- | xpath on body | ``{{ Request.Body 'xpath' '/root/id' }} `` | <root><id>123</id></root> | 123 |
39- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
40- | From data
| ``
{{ Request.FormData.email }} ``
| [email protected] | [email protected] | 41- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
42- | Header value | ``{{ Request.Header.X-Header-Id }} `` | { "X-Header-Id": ["bar"] } | bar |
43- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
44- | Header value (list) | ``{{ Request.Header.X-Header-Id.[1] }} `` | { "X-Header-Id": ["bar1", "bar2"] } | bar2 |
45- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
46- | State | ``{{ State.basket }} `` | State Store = {"basket":"eggs"} | eggs |
47- +------------------------------+-------------------------------------------------+----------------------------------------------+----------------+
21+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
22+ | Field | Example | Request | Result |
23+ +==============================+=======================================================================+==============================================================+=======================+
24+ | Request scheme | ``{{ Request.Scheme }} `` | http://www.foo.com | http |
25+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
26+ | Query parameter value | ``{{ Request.QueryParam.myParam }} `` | http://www.foo.com?myParam=bar | bar |
27+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
28+ | Query parameter value (list) | ``{{ Request.QueryParam.myParam.[1] }} `` | http://www.foo.com?myParam=bar1&myParam=bar2 | bar2 |
29+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
30+ | Path parameter value | ``{{ Request.Path.[1] }} `` | http://www.foo.com/zero/one/two | one |
31+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
32+ | Method | ``{{ Request.Method }} `` | GET /zero/one/two | GET |
33+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
34+ | Host | ``{{ Request.Host }} `` | http://www.foo.com/zero/one/two | www.foo.com |
35+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
36+ | jsonpath on body | ``{{ Request.Body 'jsonpath' '$.id' }} `` | Body: ``{"id":123,"username":"hoverfly"} `` | 123 |
37+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
38+ | xpath on body | ``{{ Request.Body 'xpath' '/root/id' }} `` | Body: ``<root><id>123</id></root> `` | 123 |
39+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
40+ | Form data
| ``
{{ Request.FormData.email }} ``
| Form: ``
[email protected] ``
| [email protected] | 41+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
42+ | Header value | ``{{ Request.Header.X-Header-Id }} `` | Headers: ``X-Header-Id: ["bar"] `` | bar |
43+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
44+ | Header value (list) | ``{{ Request.Header.X-Header-Id.[1] }} `` | Headers: ``X-Header-Id: ["bar1","bar2"] `` | bar2 |
45+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
46+ | State | ``{{ State.basket }} `` | State Store: ``{"basket":"eggs"} `` | eggs |
47+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
48+ | JWT claim (string) | ``{{ jsonFromJWT '$.payload.user_id' (Request.Header.Authorization) }} `` | Header: ``Authorization: Bearer <JWT with user_id claim> `` | 7b0d170d-... (user_id)|
49+ +------------------------------+-----------------------------------------------------------------------+--------------------------------------------------------------+-----------------------+
4850
4951Helper Methods
5052--------------
0 commit comments