GuideMock responses

Mock action and response body

Return a custom status, delay, headers and body — with Faker templates for realistic fake data.

The Mock action intercepts the matched request before it leaves the page — the real backend never sees it — and returns the response you configured. It is the only action that can change the body, status and delay.

ActionReal request sent?Can change
MockNo — answered in the pageStatus, delay, headers, body
RewriteYes — only the parts you configure changeURL, query, headers, body (both directions)
HeadersYes — browser-level header editRequest / response headers only
RedirectNo — sent to another URLDestination URL

Status, delay and headers

  • Status — any HTTP status code, e.g. 200, 201, 404, 500. The status text is derived by the browser.
  • Delay (ms) — holds the response before delivering it, to exercise loading skeletons, spinners and timeout paths. 0 delivers immediately.
  • Response headers — free-form name / value lines. The CORS preset button adds Access-Control-Allow-Origin, -Methods and -Headers in one click for cross-origin calls.

Body modes

  • Auto-detect — if the body contains a Faker placeholder the template engine runs; otherwise the body is returned byte for byte.
  • Static — always return exactly what you typed, placeholders included.
  • Template (force) — always run the template engine, even when no placeholder is present.

JSON is validated as you type and formatted on demand (Format in the editor toolbar). An invalid document is reported with the parse error and cannot be saved as valid JSON — fix it or switch the body to a JS Hook.

Faker templates

Any recognised {{...}} placeholder switches the body into template mode. Templates are powered by Faker.js, and each placeholder is a Faker module path — person.fullName, internet.email, number.int — so the library documentation covers every value you can generate.

Faker template json
{
  "code": 0,
  "data": {
    "list|3-6": [
      {
        "id|+1": 1,
        "name": "{{person.fullName}}",
        "email": "{{internet.email}}",
        "age": "{{number.int({\"min\":18,\"max\":60})}}",
        "city": "{{location.city}}"
      }
    ]
  }
}
  • "list|3-6": [...] — generate 3–6 items from the prototype.
  • "id|+1": 1 — increment the value across the generated items.
  • "age|18-60": 1 — pick an integer in the range.
  • {{person.fullName}} resolves against the built-in English (en) Faker instance. Other bundled locales are reachable with a prefix — en., fr., de. or ru., e.g. {{de.person.fullName}}.

Preview runs the template immediately and shows the generated document; Regenerate produces a fresh random sample. Each real request generates its own values, so a list refreshes on every reload.

Preview and Regenerate are next to the body — no need to reload the page to see the data.
Preview and Regenerate are next to the body — no need to reload the page to see the data.
Mock responses — including Faker templates — are available on the Free plan.

GraphQL responses

When the matched request is a GraphQL operation, the body you write is wrapped as { "data": … } automatically — write the payload only. If your body already contains data or errors, it is returned as-is.

Error and edge cases

  • Network errors cannot be produced by a mock response — it always resolves. Use status 500 plus an error body to exercise error UI, and a long delay to exercise timeouts.
  • Binary bodies (images, zip) are out of scope: mock JSON and text. Use Redirect to a local file for binary payloads.
  • Large bodies are fine in principle but count toward the 10 MB extension storage limit together with your rules.

Stuck, or need something clarified? support@mockrew.com·Terms of Service