Using the Built-in Mocking
For each API end point FLAT can generate a mock response with the status code 200 from the respective OpenAPI examples
section:
Or, written as JSON object (Mind the indentation of }
!):
To improve readability, larger objects are better put in the OpenAPI definitions
section or even into external JSON files:
or
Sending the request header Mock: true
tells FLAT to respond with a mock:
Such a mock response always identifies itself with a Mock: true
response header line.
A fitting mock response body will be picked from the examples
section according to the submitted Accept
header – with application/json
being the default.
Mock responses will be validated, if response validation is enabled in swagger.yaml
.
Last updated