How to change a server response on the fly with breakpoints
To check the canceled-order screen, you need an order with the cancelled status. The stand doesn’t have one, and asking the backend team to change data for a single check takes time. A breakpoint in Microkoi Bench holds the real server response, lets you edit its code, a header or a field, and sends it on to the app.
Why a rare response is hard to get
A delivery app shows an order in many ways: created, cooking, with the courier, canceled, restaurant closed early. A stand usually has two or three of these statuses. The rest show up once a week, and only for real users.
The alternatives are expensive. Editing the stand database means waiting for the backend. Hard-coding a response in the app means testing code that won’t ship. A breakpoint changes the response on its way, while the app and the server stay as they are.
Add a breakpoint from a recorded exchange
The shortest path starts from a request that’s already in your traffic. The proxy has to be running and the host has to be recorded.
- Open “Traffic” and select an exchange, for example GET
/v1/{id}.orders/ - In the exchange panel, click “Breakpoint”.
- A “Breakpoint added” message with the exchange address appears above the table.
The breakpoint uses the same method, host and path without query parameters, and pauses both the request and the response. If you don’t need to edit the request, open “Breakpoints” in the Traffic header and clear the “Request” checkbox. Changes are saved right away, and “Done” closes the window.
Or set one up by hand
In the “Breakpoints” window, “Add breakpoint” creates a breakpoint for any method, any host and the path /**. Narrow it down right away: as it is, it pauses every request to recorded hosts.
| Column | What to enter |
|---|---|
| “Method” | A specific method or “Any” |
| “Host” | api.example.com; an empty field means any host |
| “Path” | /v1/ matches exactly one segment, /v1/ matches any tail |
| “Request” and “Response” | What to pause: the request before the server, the response before the app |
Edit the response and let it go
Open the order screen in the app. As soon as the response matches the breakpoint, a “Response paused” window opens over any section. A countdown runs under the title: the app is waiting.
- In the body, change "status": "delivering" to "status": "cancelled".
- If needed, change the status code or add a header.
- Click “Continue” — ⌘↩ on macOS, Ctrl+Enter on Windows and Linux.
The app receives the edited response and shows the canceled-order screen. Bench sets the body length for you. A compressed response is shown unpacked; if you edit it, it goes out uncompressed and without the Content-Encoding header.
| What to check | What to change in the response |
|---|---|
| Error screen | Status code 500 or 503 |
| Empty state | An empty array instead of the order list |
| Optional field | courier: null or the field removed |
| Signing in again | Status code 401 |
| Long text | A restaurant name that wraps to two lines |
The code must be from 200 to 599. Any other value highlights the field with “Use a code from 200 to 599”, and “Continue” stays disabled until the code is fixed.
Three buttons besides “Continue”
- “Continue unchanged” lets the exchange through as it came and discards your edits.
- “Cancel request” stops the exchange: the app gets a 502 saying the request or response was canceled at a breakpoint.
- “Collapse” and Esc close the window, but the exchange keeps waiting and your edits stay until you open it again.
Collapsed exchanges show up as a bar saying how many exchanges are paused and that the app is waiting for your decision, plus a counter on “Traffic” in the sidebar. “Open” brings the window back, “Continue all” lets the whole queue through unchanged. When several exchanges are paused, they appear as tabs and are handled one at a time.
Watch the app’s timeout
- While the response is paused, the app waits. If its timeout is 15 seconds, edit faster, or the app shows a network error and the exchange drops out of the queue.
- Bench waits for your decision for up to 10 minutes, then lets the exchange through unchanged.
- Up to 32 exchanges can be paused at once; the next ones pass without stopping.
- If the app hangs, turn off “Pause exchanges” in the “Breakpoints” window: everything paused goes through as is, and the breakpoints stay.
What you see in traffic afterwards
Traffic records what actually went to the server and back to the app, edits included. In the first column of the table the exchange has an icon with the tooltip “Paused at a breakpoint”, a canceled one has “Canceled at a breakpoint”. Time spent in the editor is subtracted from the duration: the phases show the server’s work, not your thinking time.
Breakpoints only fire on recorded hosts and don’t affect WebSocket messages, mock responses or mock servers. If you need the same response every time, a mock is the better fit: a breakpoint is for one specific exchange, here and now.
Breakpoints are a personal tool
Breakpoints are stored on this computer, separately for each workspace, not in the workspace folder. They don’t go to git or to your teammates, and they survive a Bench restart.
What you get
A rare server response takes half a minute to get, exactly when you need it: a canceled order, an empty list, a 401 in the middle of a session. The app is tested against the real server, not a stub in the code.
Set a breakpoint on a screen you haven’t checked in a while in beta 0.9.6, and write to beta@microkoi.com about the responses you edit most often. We read every email.