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

All paths are relative to the site root.
MethodPathBehaviour
GET/api/health200, service heartbeat
GET/api/ordersPaged list. ?status= ?city= ?page= ?limit=
POST/api/orders201 on success, 422 when customer or sku missing
GET/api/orders/:id200 or 404
PUT/api/orders/:id200 with the merged record
DELETE/api/orders/:id204, no body
GET/api/productsPaged list. ?q= ?category=
POST/api/products201, or 422 without name
GET/PUT/DELETE/api/products/:idas for orders
GET/api/slowAlways ~3000ms, then 200
POST/api/echo200, echoes the parsed request body
GET/api/session200, always {authenticated:false}

Per-request overrides

Request runner

Status: - Elapsed: - Transport: -
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.

Products returned by the last call
SKUName CategoryPrice
Not loaded yet.