mock-response, as the name implies, is used to mock APIs and operations. It aborts normal pipeline execution and returns a mocked response to the caller. The policy always tries to return responses of highest fidelity. It prefers response content examples, whenever available. It generates sample responses from schemas, when schemas are provided and examples are not. If neither examples or schemas are found, responses with no content are returned.
XML<mock-response status-code="code" content-type="media type"/>
XML<!-- Returns 200 OK status code. Content is based on an example or schema, if provided for thisstatus code. First found content type is used. If no example or schema is found, the content is empty. --><mock-response/><!-- Returns 200 OK status code. Content is based on an example or schema, if provided for thisstatus code and media type. If no example or schema found, the content is empty. --><mock-response status-code='200' content-type='application/json'/>
Sets response body
Specifies response status code and is used to select corresponding example or schema.
This policy can be used in the inbound, outbound, and on-error policy scopes.