Route Behavior
Chaos Injection
Real APIs fail sometimes, and your app's error handling only gets tested if it actually sees an error. Chaos injection makes a route fail at random, at a rate you choose, so you can watch your retry logic, error states, and loading fallbacks actually run.
Pro feature — free during the beta.
How it works
Set an error rate between 0% and 100% in the route's Advanced section. On each request, MockBase rolls the dice independently: at a 20% rate, roughly 1 in 5 calls returns the configured error status instead of the route's normal response. It's a per-request roll, not a fixed pattern — you won't get exactly every 5th request failing.
Pick the status code the failure returns (500 by default) so you can test against the specific error your app needs to handle, not just a generic one. When chaos fires, that's all the route returns for that call — no template rendering, no configured headers, just the error status and a fixed body identifying it as an injected failure.
Chaos vs. delay
These are two different, independent things: delay (the route's delay_ms setting) is free on every mock and just slows a response down — the response is still the one you configured. Chaos is Pro-only and replaces the response with an error. Turn on both and a chaotic request is slow and wrong, which is often exactly what a flaky-upstream test should look like.
Chaos isn't available on a stateful CRUD route — a stateful route's whole response is generated from stored data, so there's no "normal response" for chaos to replace.
Using it
A 100% rate is useful for confirming an error path works at all. Something lower — 10-20% — is closer to simulating a genuinely flaky upstream, so you can see whether retries and backoff actually kick in under realistic conditions instead of failing outright on the first bad response.