Mock server
Each collection has a Mock server tab that serves the examples saved on its requests. To save one, send a request, then use the response's "…" menu → Save as example.
- Starting it: pick a port, an optional delay, and whether other devices on your network may connect; then start it. Use in an environment creates (or updates) a copy of your environment, "
(mock)", whose {{BASE_URL}}-style variables point at the mock, and switches to it. - Matching: routes match on method and path.
:idand{{variable}}segments match any value, and literal segments win. - Choosing an example: clients can pick a specific one with the
x-mock-response-nameorx-mock-response-codeheader; otherwise the first 2xx example answers. The response'sX-Mock-Exampleheader names the one used. - Other behaviour:
- CORS is open to every origin, so any web page in your browser can read the examples while the mock runs.
- Requests without examples answer 501 with a hint, and unknown paths list the available routes.
- Recent requests are shown live.
- Mock servers stop when the app locks or quits (on macOS, closing the window doesn't quit).