Skip to content

@default token

Loïc Diringer edited this page May 5, 2017 · 1 revision

The @default folder is a special type of folder in the mock file hierarchy.

It can contain "default" mocks for a specific resource in the API.

For instance, the following request will have Mockiji to search for :

  • Request: GET api/v1/users/kate/books/42
  • Searched paths (only two paths to simplify):
    • api/v1/users/kate/books/get_42.json
    • api/v1/users/@default/books/get_42.json

The first file api/v1/users/kate/books/get_42.json will be load if found.
Else if the second file api/v1/users/@default/books/get_42.json will be load if found.
Else Mockiji will return a Mock-not-found response.

With a @default folder in the users folder, you can make a default response for the 42 book for any users,

Clone this wiki locally