# Demonstrates mapping requests over a list of values plus iteration-matched mapped dependencies.
# Will perform 12 requests in total:
# 0-5. Echo a request [ROLE=..., USERNAME=...]
# 6-11. Echo mapped dependency [ROLE=..., USERNAME=...]
$ REST_ORIGIN = https://lorem-api.com/api
$ ROLE = [admin, user, guest]
$ USERNAME = [foo, bar]
---
Echo a request
POST {{ REST_ORIGIN }}/echo
~~~ application/json
{
"username" : "{{ USERNAME }}",
"role" : "{{ ROLE }}"
}
~~~
# Echo request succeeds
^ & status == 200
# Echoes the mapped username
^ & body.username ~= /bar|foo/
# Echoes the mapped role
^ & body.role ~= /admin|user|guest/
---
Echo mapped dependency
> requires: Echo a request
POST {{ REST_ORIGIN }}/echo
~~~ application/json
{
"username" : "{{ USERNAME }}",
"role" : "{{ ROLE }}",
"dependencyMatched" : true
}
~~~
# Dependent mapped request succeeds
^ & status == 200
# The matching mapped dependency has the same username
^ & body.username == &[Echo a request].body.username
# The matching mapped dependency has the same role
^ & body.role == &[Echo a request].body.role
# Echoes that the dependency-aware request ran
^ & body.dependencyMatched == true