Skip to main content
A mock response is what GoDizzy returns to your agent or client instead of forwarding the request to your target endpoint. You configure the status code, headers, body, and a latency range — and GoDizzy serves that fixture every time the rule matches, with no outbound traffic.

Configure a mock response

1

Open your route collection

In the dashboard, navigate to Routes, select your environment, and open the route collection that contains the rule you want to configure.
2

Create or select a routing rule

Click Add Rule to create a new rule, or click an existing rule to edit it. Set the HTTP method and path pattern for the rule to match (for example, POST and /api/search).
3

Set the action to Mock

In the rule editor, set the Action to Mock. If the rule was previously set to Proxy, the toggle on the rule card also switches between the two modes — flip it to enable mocking without opening the full editor.
4

Enter the status code

Enter the HTTP status code GoDizzy should return. Use any valid code: 200 for success, 429 for rate-limit simulation, 500 for error scenarios, and so on.
5

Add response headers (optional)

Provide response headers as a JSON object. Each key is a header name and each value is the header value string.
{
  "Content-Type": "application/json",
  "X-Request-Id": "{{$randomUUID}}"
}
Template variables such as {{$randomUUID}} work in header values. See the Template variables section below for the full list.
6

Write the response body

Enter the response body as a JSON string. This is the exact payload GoDizzy returns to the caller.
{
  "results": [
    { "id": "{{$randomUUID}}", "title": "Annual report Q4", "score": {{$randomInt(70,99)}} },
    { "id": "{{$randomUUID}}", "title": "Budget forecast", "score": {{$randomInt(50,69)}} }
  ],
  "query": {{$reqBody['q']}},
  "total": 2,
  "retrieved_at": "{{$isoTimestamp}}"
}
7

Set the latency range

Enter a Min latency (ms) and Max latency (ms). GoDizzy picks a random value in that range before responding. Set both to 0 for an immediate response. See the Latency Injection guide for more detail.
8

Save

Click Save. GoDizzy creates a new version of the mock response. Your previous configuration is preserved in version history and can be restored at any time.

Template variables

Mock response bodies and headers support template placeholders that GoDizzy expands at response time. You can reference random values, timestamps, and fields from the incoming request body.
SyntaxDescriptionExample
{{$randomUUID}}RFC 4122 UUID v4, unique per response"id": "{{$randomUUID}}"
{{$randomInt(a,b)}}Integer between a and b inclusive — omit quotes for a JSON number"score": {{$randomInt(0,100)}}
{{$randomAlphaNumeric(n)}}n characters from A–Z, a–z, 0–9"token": "{{$randomAlphaNumeric(16)}}"
{{$randomBoolean}}true or false — omit quotes for a JSON boolean"ok": {{$randomBoolean}}
{{$randomHex}}16-character lowercase hex string"hash": "{{$randomHex}}"
{{$randomHex(n)}}n-character lowercase hex (1–256)"hash": "{{$randomHex(32)}}"
SyntaxDescriptionExample
{{$isoTimestamp}}UTC instant in ISO 8601 format — use inside string quotes"at": "{{$isoTimestamp}}"
{{$date}}YYYY-MM-DD in UTC — use inside string quotes"day": "{{$date}}"
{{$unixSeconds}}Seconds since Unix epoch — omit quotes for a JSON number"created": {{$unixSeconds}}
{{$unixMs}}Milliseconds since Unix epoch — omit quotes for a JSON number"ts": {{$unixMs}}
{{$reqBody['key']}} expands to the value of a top-level field in the incoming JSON body. A missing key or a non-JSON body expands to JSON null.
{
  "echo": {{$reqBody['message']}},
  "user_id": {{$reqBody['userId']}}
}
$reqBody is only available when the rule’s HTTP method is POST, PUT, or PATCH. It is not available for GET, DELETE, or wildcard (*) rules. It also cannot be used in response headers — only in the body.

Switching between mock and proxy

You do not need to open the rule editor to switch a rule’s behavior. Each rule card has a toggle in the rule list view:
  • Toggle on (Mock) — GoDizzy returns the configured mock response.
  • Toggle off (Proxy) — GoDizzy forwards the request to the collection’s target endpoint.
The toggle directly changes the rule’s action. Switching to proxy does not delete your mock response configuration — it is preserved and takes effect again the moment you toggle back to mock.

Version history and rollback

Every time you save changes to a mock response, GoDizzy creates a new immutable version. Your previous configuration is never overwritten.
1

Open version history

On the rule detail page, click View History. The history panel lists every version with the timestamp and the email address of the team member who made the change.
2

Inspect a prior version

Click any version to view its full configuration: status code, headers, body, and latency range.
3

Revert

Click Revert to this version on the version you want to restore. GoDizzy creates a new version with the content of the selected prior version — it does not delete the intervening history.
Revert is non-destructive. Reverting to version 3 while you are on version 7 creates version 8 — which is a copy of version 3. Your full edit history remains intact.

Example: simulating a rate-limited response

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests. Retry after {{$randomInt(10,60)}} seconds.",
    "retry_after": {{$randomInt(10,60)}},
    "request_id": "{{$randomUUID}}"
  }
}
Set the status code to 429 and configure a latency range of 200800 ms to simulate a realistic throttled API response your agent needs to handle gracefully.