Dynamic Data
The Investigate API contract lists a series of examples that describe edge cases that you can test.
To test a concrete scenario, specify the Prefer
HTTP header when making requests to the mock server.
Do not include actual PII data within the request.
The Prefer
HTTP header​
The Prefer
HTTP header specifies the type of HTTP response you want the mock server to return. The following table shows examples.
Prefer contents | Description of the response | Example |
---|---|---|
Empty value, missing header or dynamic=false | Static data, which translates into returning the hardcoded example provided in the contract | Prefer: dynamic=false |
dynamic=true | Dynamic data by applying generators to all documented properties (listed as x-faker in the contract) | Prefer: dynamic=true |
code=<number> | An example for the specified status code | Prefer: code=500 |
example=<name> | The example matching the specified name. If no code is specified, the provided name must be listed in the default 200 status code. | Prefer: example=people/common/dynamic-successful-responses |
code=<number>, example=<name> | The example matching the specified name in the specified status code | Prefer: code=207, example=people/common/dynamic-mixed-responses |
echo=true | Echo the incoming request to the response | Prefer: echo=true |
As shown in the previous example, you can combine dynamic
, code
and example
using a comma-separated list in order to get the desired scenario.
All responses are randomly generated and are independent from each other. Therefore, don't expect to receive the same response by sending the same request body unless you are requesting a specific example.
Random successful and error responses​
Due to the inversion of control that the mock server implements, it's up to the clients to randomize correct and error responses by alternatively requesting 200 and other status codes.
Chaos engineering must be managed on client the side.