Skip to main content

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.

caution

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 contentsDescription of the responseExample
Empty value, missing header or dynamic=falseStatic data, which translates into returning the hardcoded example provided in the contractPrefer: dynamic=false
dynamic=trueDynamic 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 codePrefer: 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 codePrefer: code=207, example=people/common/dynamic-mixed-responses
echo=trueEcho the incoming request to the responsePrefer: echo=true
tip

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.

caution

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.

info

Chaos engineering must be managed on client the side.