Skip to content

404 page

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

Summary

When mockiji receives a request, it will search for files matching the request according to the rules.

If no file match the request, there will be no file to load.
Instead, a handy JSON response will be built and shown.
It features the paths which were looked up in your file hierarchy.

This response can help you to understand why no mock were found and loaded.
It can also help you to choose where to create file in your mock hierarchy.

Example

On the default configuration and provided a request GET http://localhost:8080/api-simple-library/users/kate/comics, it should look like this:

{
  "errorCode": 404,
  "errorDescription": "No mock file was found",
  "evaluatedMockFilePaths": [
    "/srv/www/mockiji/mocks/api-simple-library/users/kate/comics/get.*",
    "/srv/www/mockiji/mocks/api-simple-library/users/kate/get_comics.*",
    "/srv/www/mockiji/mocks/api-simple-library/users/get_kate_comics.*",
    "/srv/www/mockiji/mocks/api-simple-library/get_users_kate_comics.*",
    "/srv/www/mockiji/mocks/api-simple-library/users/kate/@default/get.*",
    "/srv/www/mockiji/mocks/api-simple-library/users/@default/comics/get.*",
    "/srv/www/mockiji/mocks/api-simple-library/@default/kate/comics/get.*",
    "/srv/www/mockiji/mocks/@default/users/kate/comics/get.*",
    "/srv/www/mockiji/mocks/api-simple-library/users/@default/get_comics.*",
    "/srv/www/mockiji/mocks/api-simple-library/@default/kate/get_comics.*",
    "/srv/www/mockiji/mocks/@default/users/kate/get_comics.*",
    "/srv/www/mockiji/mocks/api-simple-library/@default/get_kate_comics.*",
    "/srv/www/mockiji/mocks/@default/users/get_kate_comics.*",
    "/srv/www/mockiji/mocks/@default/get_users_kate_comics.*"
  ]
}
Field Description
errorCode It matches the current HTTP response and can be changed in the configuration (http_codes.mock_file_not_found key).
errorDescription It's a text description of the current situation
evaluatedMockFilePaths It's an ordered list containing the paths where Mockiji tried to find a mock file to load (glob pattern)
Clone this wiki locally