API mocks right in the proxy — no mock server needed
Replace server responses without touching the backend or reconfiguring your app. It receives the status, headers and body you set, and the request never reaches the server.
A mock in thirty seconds
- 1
Find the requests
Pick an exchange in traffic, or tick the branches you need in the endpoint tree — you get mocks for all of them at once.
- 2
Click “Make mock”
The mock gets the same method, host, path and the last captured response. It is created disabled, so nothing is replaced too early, and clicking again never creates duplicates.
- 3
Edit and enable
Set the status, body and delay you need, save with ⌘S and flip the toggle.
What people test with mocks
Anything that is hard or slow to reproduce on a real server.
Rare errors
500, 503, 429 with Retry-After — see how your app survives a failure your test server never produces.
Slow responses
A delay in milliseconds shows how spinners and timeouts really behave.
Empty lists
An empty cart, no notifications, no search results — without preparing test data.
Unfinished endpoints
Describe the response you agreed on with the backend and start on the client right away.
Expired sessions
Replace the token refresh response and check how your app signs the user out.
Mocks from the endpoint tree
A button on a branch creates one mock per method and path inside it, and selection mode collects them from several branches at once.
Visible in traffic
A mocked exchange is marked in the table, and a button with the mock’s name opens it in the editor.
How it works
Rules with path wildcards
A mock matches on method, host and path. Leave method or host empty to match any. In the path, a single asterisk stands for one segment and a double asterisk for any tail.
- /api/users/* matches /api/users/42 but not /api/users/42/orders
- /cdn/** matches everything under /cdn
- /**/avatar.png matches that file at any depth
- The query string is ignored; hosts are compared without case or port
The most specific rule wins
When several mocks match, the most specific one wins: a literal path beats a wildcard, more exact segments beat fewer, and a set host or method beats “any”. No manual ordering, and the result never depends on file order.
A tree of mocks and groups
Mocks are shown as a list or as a tree by host and path segments: api.example.com › v1 › orders › GET List orders. A button on a host or folder enables every mock inside when all are off, and disables them when at least one is on.
- A group of mocks collected from traffic switches on with one click when the server is down, and off just as easily
- The trash button on a branch deletes every mock inside after a confirmation that names how many
- Tree folders reflect the address, not storage: change the path in the editor and the mock moves to the right branch
- Search covers name, method, host and path, and branches with matches expand in full
Mocks are files
Each mock is a .mock.json file in the workspace’s mocks folder, and its response body is a separate file next to it: real JSON, an image, a PDF or an archive. They go to git along with requests and notes. Renaming a mock renames its files without breaking links to it from traffic.
- Set the body as text or pick any file; images get a preview
- The “Serve as a file download” toggle adds the right header
- Edits to the body file in another editor and mocks pulled from git are picked up immediately
- A corrupted file is skipped instead of breaking the list
- Mocks from different workspaces never mix
The editor warns you upfront
If a mock cannot fire, you see it right away: when the proxy is stopped, or when the mock’s host is not captured by the workspace filter. For JSON bodies the editor checks the syntax and can format it.
- Edits apply after saving; the toggle enables a mock immediately
- Switching to another mock with unsaved edits asks whether to keep them
Questions and answers
Do I need to run a separate mock server?
Not for mocks. They work inside the Microkoi proxy: an app routed through the proxy receives the replaced response at the same address as usual. If you need a separate API on its own port that your app calls directly, that is what mock servers are for.
Does the request reach the real server when a mock fires?
No. The proxy answers instead of the server, and the exchange is recorded in traffic with your app’s request body, the mock’s response and the time including the delay.
Why isn’t my mock firing?
Make sure the proxy is running and the mock’s host is captured by the workspace filter: connections to excluded hosts pass through an opaque tunnel where responses cannot be replaced. The mock editor warns about both cases.
Can I share mocks with my team?
Yes. Mocks are files in the workspace’s mocks folder — commit them and your teammates get the same rules.