Response Variants & Default
A mock endpoint can return more than one response. Each possible response is called a variant, and every variant is edited separately. Exactly one variant on each endpoint is the default. Understanding this pair of ideas is the key to the entire response side of the mock server.
What a Variant Is
A variant is a complete response body bundled with a content type, a Default checkbox, and its own set of rules. Everything else — status code, delay, response headers — is shared across all variants of the endpoint and lives in the strips above the variant tabs.
Typical use cases for having multiple variants on one endpoint:
- •Happy path and error path: one variant returns the normal payload, a second returns an error-shaped body. A rule on the error variant picks it when the incoming request carries a flag or matches a specific header.
- •Per-customer or per-tenant data: the rules look at a JSON field or header in the incoming request and pick the variant that holds the data for that tenant.
- •Different shapes of the same resource: for example, an empty list, a short list, and a paginated list — each represented by its own variant so you can test all three cases from a single endpoint.
The Default Variant
At the top of the Body sub-tab of every response variant there is a checkbox labelled Default. The rules are simple:
- •Exactly one variant is the default. Ticking the Default box on another variant moves the mark automatically — the previous default is un-ticked in the same step.
- •The default cannot be un-ticked by clicking it. The only way to un-default a variant is to make another variant the default instead. This keeps the endpoint always having a fallback to fall back to.
- •Deleting the default automatically promotes the first remaining variant to default, so you never end up with an endpoint that has no default.
How the Default Gets Picked
When a request reaches the mock, the server walks the endpoint's variants and checks each non-default variant's rules. Think of the default as the catch-all "if none of the others match"response:
- •If a non-default variant's rules match, that variant wins — the mock returns its body and headers with the endpoint's shared status and delay.
- •If none of the non-default variants match, the default variant is returned. This is why the default is the only variant that does not need rules: nothing ever competes with it except the other variants.
- •The default variant's Rules sub-tab is informational only. Opening it shows a small message explaining that rules are not evaluated for the default — there is nothing there to edit.
Practical Advice
Keep the default as the "everything is fine" response — the one your client should usually see — and move edge cases, errors, and variations into non-default variants guarded by rules. That way the endpoint still answers correctly even when the rules are incomplete or when you are still experimenting with them: you fall back to the happy path rather than to an error.