An HTTP response is made of a payload -what you are mainly interested in- but also contextual information.
Using API Fortress you generally verify the payload, but you can also deal with the whole response “envelope”.
In the composer, when you’re making an HTTP request, you’re providing a variable name. That variable will host the response payload.
Let’s say “payload” is the name of that variable. When the operation completes, another variable called <variable_name>_response is also created, in this example “payload_response”. That variable will host the response “envelope”.
So by referencing the “payload_response.statusCode” expression you can access the status code. For example, if you want to run a branch of code when the status code is 400, here’s how you do it:
You can have multiple ‘IF’ conditions for checking all the possible status codes you need to check.
Headers are also a big part of the response.
Let’s say you want to check that a resource shouldn’t be cached: