An endpoint (static mock) always has a default response. It can also have up to 20 conditional responses, checked top to bottom. The first one whose conditions all match is sent; if none match, the default is sent. Fault scenarios still apply on top, so "valid card → 201, declined card → 402, and 10% of everything → 503" is one endpoint plus one scenario.
Modelled on Beeceptor's mock rules (first match wins, AND-combined conditions, request-derived templates). Differences: rules live on an endpoint, whose method and path are already matched; regex uses RE2 syntax with linear-time matching; template randomness is seeded and replayable; the inspector shows why a response was chosen.
Conditions
| Source | Key | Example |
|---|---|---|
| Header | header name (case-insensitive) | X-Test-Scenario equals declined |
| Query param | param name | page greater than 1 |
| Path param | a {name} from the endpoint's path |
id equals 42 (path /orders/{id}) |
| Body field | JSON dot path: card.number, items[0].sku, items.0.sku, items.length |
amount greater than 1000 |
| Raw body | (none) | contains "currency":"INR" |
Operators: equals, does not equal, contains, does not contain, exists, does not exist, matches regex (RE2 syntax, partial match), is greater than, is less than (numeric; non-numbers never compare).
- A repeated query param matches if any value matches. Negative operators pass only if no value matches, and a missing value counts as passing.
- JSON
nullcounts as missing. Objects and arrays compare as compact JSON text. - Limits: 10 conditions per response; regex at most 512 characters.
Templates
Turn on Template for a response (default or conditional) to render {{ … }} in its body and header values.
| Expression | Renders |
|---|---|
{{ body.user.id }}, {{ body.items[0].sku }} |
JSON body field |
{{ path.id }}, {{ query.page }}, {{ header.x-trace }} |
path param, query param, header |
{{ method }}, {{ url }} |
request method and path |
{{ query.page | 1 }}, {{ body.name | "anonymous" }} |
default when missing |
{{ json body.user }} |
value as JSON (strings quoted; null if missing) |
{{ uuid }}, {{ randomInt 1 100 }} |
random, seeded: replaying with the same X-Jitterbox-Seed gives the same values |
{{ now }}, {{ timestamp }} |
ISO-8601 time, epoch millis |
Plain {{ … }} inserts raw text, so put quotes around strings yourself ("id": "{{ path.id }}"), or use json.
Templates are checked when you save; unknown expressions are rejected.
In the inspector
Each request's Decisions tab shows "Response selection": which response was sent, and for each response it
checked, every condition with the value Jitterbox found in the request (✓ body.card.number equals "4000…" · got "4000…").
API
EndpointInput gains template: boolean and conditionalResponses: ConditionalResponse[]:
ConditionalResponse = {
name: string,
conditions: { source: "HEADER" | "QUERY" | "PATH_PARAM" | "BODY_FIELD" | "BODY", key?: string,
op: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "EXISTS" | "NOT_EXISTS" | "MATCHES" | "GREATER_THAN" | "LESS_THAN",
value?: string }[],
status: number, headers: Record<string, string>, body: string | null,
delayMs: number, // replaces the endpoint's delay when this response is chosen
template: boolean
}
Validation keys look like conditionalResponses.{i}.conditions.{j}.value. Conditional responses aren't
available on LLM endpoints. The selection is recorded as a RESPONSE_SELECTED timeline event.