Skip to content

Mock Server

The Mock Server boots a local HTTP server directly from a .mock file. Declare routes, match rules, and templated responses in plain text — save the file and your teammates can run the exact same mock with git pull.

@port = 3500
@cors = permissive
### GET /users/:id
HTTP/1.1 200 OK
Content-Type: application/json
{ "id": {{param.id}}, "name": "Jane", "createdAt": "{{now}}" }
### POST /users
# @match method = POST
# @status 201
# @delay 150ms
Content-Type: application/json
{ "id": "{{uuid}}", "name": "{{body.name}}" }

Press ⌘Enter or click ▶ at the top of the file. The Mock panel shows Running on :3500 — point any HTTP client at http://localhost:3500.

  • ⌘Enter or the ▶ button starts the server.
  • Save the file (⌘S) — the server auto-reloads instantly. In-flight requests finish against the old definition; new requests hit the new one.
  • Click Stop in the Mock panel to tear it down. Closing the file also stops the server.

Routes match on path, method, query, headers, and body. Combine as many as you need:

### Authenticated list
# @match method = GET
# @match path = /users
# @match header.authorization contains Bearer
# @match query.page = 1
HTTP/1.1 200 OK
Content-Type: application/json
{ "data": [], "page": 1 }

See the .mock reference for the full directive list.

Response bodies support request-aware template variables:

  • {{param.id}}, {{path.0}} — path params and segments
  • {{query.<name>}} — query-string values
  • {{header.<name>}} — incoming headers
  • {{body.<json-path>}} — fields from a JSON body
  • {{uuid}}, {{now}}, {{random(0,100)}} — built-ins

Point unmatched requests at a real upstream — perfect for stubbing just the endpoint you care about:

@port = 3500
@forward = https://api.prod.example.com
### Flag this endpoint as enabled for testing
# @match path = /v1/features/beta
HTTP/1.1 200 OK
{ "feature": "enabled" }

Everything else streams through to the upstream and is logged with a forwarded badge.

The Mock panel shows every incoming request in real time with the matched route, status, duration, and templated body. Click any row to inspect the full request/response pair.

CapabilityFreePro
Author .mock files
Start a server with up to 3 routes
Unlimited routes
@forward upstream proxy
@repeat, advanced @template vars