Skip to main content

Mock Schema

A mock schema is a serializable object that describes one HTTP mock. It consists of a reqSchema, which defines the request to match, and a resSchema, which defines the mocked response to return.

Example:

{
reqSchema: {
method: 'GET',
url: 'https://example.com',
},
resSchema: {
status: 200,
body: 'Hello world',
}
}

This schema will match the request:

GET https://example.com

and make it return the response:

HTTP 200 OK
Hello world

See the Request Schema and Response Schema pages for the full set of available options.