Route Behavior

Default Response

By default, a request that matches no route gets a 404 carrying MockBase's own route_not_found error. That's the right behavior most of the time — but when you're standing in for an API whose full surface you haven't mapped yet, you often want everything to answer with something sensible instead.

Setting one

Open the Default response panel on the mock's page, pick a status code, and write the JSON body. It applies to the whole mock: any method, any path, whenever no route matched.

Remove it and unmatched requests go back to the built-in 404.

Why this isn't just a catch-all route

Route matching is per method and path, so no single route can answer "anything else". A {param} segment only matches one path segment, meaning /users/{id} never catches /users/1/orders, and a route is bound to one method anyway. The default response sits outside that matching entirely, which is what lets it catch everything.

Order of precedence

For a request that matches no route:

  1. If Record & Replay is configured, the request is proxied to your real upstream and captured. Record & Replay wins, because sending the request on is a more specific intent than answering it locally.
  2. Otherwise, if a default response is set, it is returned.
  3. Otherwise, the built-in 404 route_not_found.

A request that does match a route is unaffected — the default only ever fills the gap.

Useful shapes

  • A permissive stub while you build. 200 with {} so a client under development never hard-fails on a path you haven't mocked yet.
  • A realistic 404. Your real API's own not-found body, so error handling is tested against the shape it'll actually see in production rather than MockBase's.
  • A loud placeholder. 500 with {"error": "not mocked yet"}, which makes an unmocked path obvious in a test run instead of quietly looking like a normal 404.

Unmatched requests still appear in the Request Inspector with whatever status the default returned, so you can see exactly which paths fell through and turn the common ones into real routes.