API lab
Every endpoint the mock layer serves, with per-request controls for status code,
latency and failure. Use these for page.route, page.request and
response-mocking exercises.
Mock transport in this tab: detecting...
service-worker (the default on http/https) — a
Service Worker synthesises every /api/* response. Writes, latency and flake all
work. Because the response never reaches the network stack,
page.route() and page.request cannot see these calls.
static-files (add ?mock=static) — no
worker is registered and /api/* resolves to the static JSON snapshots in
/api/ over the real network. Route interception and
page.request work fully here. Read-only: POST, PUT and DELETE are not served.
fetch-patch (file://) — a
window.fetch patch answers in-page calls only.
Endpoints
| Method | Path | Behaviour |
|---|---|---|
| GET | /api/health | 200, service heartbeat |
| GET | /api/orders | Paged list. ?status= ?city= ?page= ?limit= |
| POST | /api/orders | 201 on success, 422 when customer or sku missing |
| GET | /api/orders/:id | 200 or 404 |
| PUT | /api/orders/:id | 200 with the merged record |
| DELETE | /api/orders/:id | 204, no body |
| GET | /api/products | Paged list. ?q= ?category= |
| POST | /api/products | 201, or 422 without name |
| GET/PUT/DELETE | /api/products/:id | as for orders |
| GET | /api/slow | Always ~3000ms, then 200 |
| POST | /api/echo | 200, echoes the parsed request body |
| GET | /api/session | 200, always {authenticated:false} |
Per-request overrides
__status=500— force any HTTP status__latency=2500— force latency in milliseconds__flake=1— force a 503flaky_upstreamresponse__empty=1— return an empty collection
Request runner
Nothing sent yet.
Scenarios
Each button fires one request and renders the outcome below. The labels are unique,
so getByRole('button', { name: ... }) is enough.
No scenario run yet.
Live products
Fed by GET /api/products?limit=6 on every refresh. Intercept that route
and this table renders whatever you return.
| SKU | Name | Category | Price |
|---|---|---|---|
| Not loaded yet. | |||