Backend-dependent UI development is a bottleneck. The API is down, staging has stale data, or the edge case you need — an empty cart, a 403, a malformed JSON field — does not exist in any environment. Teams respond with hardcoded mocks in unit tests, feature flags, or local stub servers. All of these work, but they require code changes, PRs, and often a restart. The Response Modifier lets you rewrite live traffic at runtime without touching your backend or recompiling.
How it works
After DebugSwift captures a URLSession response, the Response Modifier checks active rules before your app sees the data. Matching rules can override the HTTP status code and response body. Non-matching traffic passes through unchanged. Rules toggle on and off individually, so you can keep a library of test scenarios and enable one at a time.

Rule matching
- Match by exact URL or wildcard pattern
- Override status code — test 401, 404, 500 without server cooperation
- Replace the response body with custom JSON, XML, or plain text
- Body editor with JSON validation to catch syntax errors before saving

Generate rules from live traffic
The fastest workflow: reproduce the real request in your app, find it in the Network tab, and generate a modifier rule from the captured response. You start with production-shaped data, then edit the fields you need to test. No hand-writing URLs from memory.
Import and export with CSV
Share rule sets across teammates via CSV import and export. A QA engineer can load the same error-state rules a developer created, or you can version-control a CSV of regression scenarios alongside your test plan.
Practical scenarios
- Empty list — return [] for a feed endpoint to test your zero-state UI
- Pagination end — cap results at page 2 to verify the footer spinner stops
- Auth expiry — force 401 on a protected route and confirm the login redirect
- Slow network — combine with request thresholds to verify loading states
- Offline shape — return cached-shaped JSON when the real API is unreachable
Limits to know
The Response Modifier intercepts URLSession traffic inside your DEBUG build. It does not affect WKWebView loads, raw socket connections, or gRPC streams unless they route through URLSession. Disable all rules when testing against real staging to avoid confusing results. Nothing ships to release — the modifier exists only in debug binaries.
