Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.96 KB

service-config.md

File metadata and controls

62 lines (45 loc) · 1.96 KB

Service config mix-n-mock logo

Each HTTP method configuration file looks like this:

{
    "active": true,
    "services": [
        {
            "active": true,
            "path": "exampleEndpoint",
            "file": "delete-result.example.json",
            "delayBy": 5000
        },
        ...
    ]
}

active

The main active switch can be used switch the whole mock configuration for the particular HTTP method on or off.

services

The services array holds the individual configuration for each server route which should be mocked.

active

The active switch is used to toggle the mocking of the individual route.

path

The path stores the route which should be mocked. It is a path relative to the serviceBasePath of the server.root.json.

file (optional)

The JSON file which has to be returned if the route is called. The file name will be resolved relative to mock path specified in the filesystem.path.json followed by the HTTP method name. E.g. file is set to "delete-result.example.json", mock is set to "example-mocks" and the configuration file is DELETE.mock.json then the application will return example-mocks/DELETE/delete-result.example.json. The file property can be left out if the HTTP response should contain no body.

delayBy (optional)

The amount time (in milliseconds) which passes before the file is returned.

status (optional)

A route can not only return a static mock file but is also able to return any HTTP code. This is configured by adding the optional status property in which the HTTP code can be specified:

{
    "active": true,
    "services": [
        {
            "active": true,
            "path": "exampleEndpoint",
            "file": "delete-result.error.json",
            "delayBy": 5000,
            "status": 500
        }
    ]
}