Response Conditions
Response conditions determine which named response is returned for an incoming request. Without conditions, the default response is always used. With conditions, you can simulate complex, request-driven scenarios.
What it does
A condition is a tree of rules combined with AND / OR logic. The builder supports leaf rules (HTTP method, header, query string, URL path, body text, JSON Path, XPath, array/collection) and logical wrappers (All of, Any of, NOT). A named response matches when its condition tree evaluates to true.
When to use
- Return a 401 when the
Authorizationheader is missing. - Return a 404 when the URL path contains an unknown ID.
- Return a 500 when a query parameter
fail=true. - Return an admin view when a JSON body field equals
"admin".
How to use
Open the Condition Builder
In the Edit Response window, select a named response tab. The left pane shows the Condition: builder. (The Default response has no condition — it is the fallback.) Use Hide Condition / Show Condition to collapse the pane.
Choose the root logic
At the top of the builder, Match: toggles between:
- All of — every rule/group must be true (AND).
- Any of — at least one rule/group must be true (OR).
Add rules and groups
- Add Rule — append a condition rule. Pick the type from the list.
- Add Group — append a nested group (another All of / Any of block) for nested AND/OR.
- Remove — delete a rule or group.
Condition types
| Type | Matches | Key fields |
|---|---|---|
| HTTP Method | The request verb | HTTP Method (GET, POST, …) |
| HTTP Header | Request header name/value | Headers (name/value pairs) |
| Query String | Query parameters | Query Parameters (name/value pairs) |
| URL Path | The request path | Path Pattern, Path Parameters |
| Text Contains | The request message contains specific text/pattern | Content, Compare Mode |
| JSON Path | A JSON body field via JSONPath | JSONPath Expression, Expected Value, Compare Action |
| XPath | An XML body element/attribute via XPath | XPath Expression, Expected Value, Compare Action |
| Array/Collection | Items in a JSON/XML array | Path Type, Path, Array Compare Mode, Expected Count/Item |
| NOT (Negate) | Inverts an inner condition | Inner Condition (select/edit) |
Compare modes
Text and path comparisons support: Binary (Case Sensitive), Case Insensitive, Loose (Ignore Case and Spaces), Regular Expression, and Regular Expression (Ignore Case).
Negation (NOT)
Add a NOT (Negate) rule and choose its inner condition. The rule matches when the inner condition does not hold — for example, NOT (Header Authorization exists) → return 401 when no auth header is present.
Test the condition
- Quick Test () — evaluate the condition against the current sample request and show a pass/fail info bar inline.
- Test Condition () — open the sample-request editor to paste a request (URL, headers, body) and verify which response is selected.
The sample request is stored per saved response (SampleRequest) and is reused by the tester.
Priority and ordering
Named responses are evaluated top-to-bottom in the Edit Response window tabs (use Move Up / Move Down to reorder; the Default stays first). Within an All of group, rules are evaluated in order — place more specific rules above more general ones. Conditions and scenarios work together: activate the baseline via responses, and let conditions pick the exact variant per request.
:::info Screenshot needed — light/dark 📸
condition-builder-light.png and condition-builder-dark.png — the Condition Builder showing a JSON Path rule with the root All of logic and the Test result.
:::