android_traffic_mock_add
Add (or update in place, if id matches an existing route) a mock/abort rule that short-circuits future matching HTTPS requests on this device inside the TLS-inspecting proxy — the request never reaches the real server. mode "mock" (default) returns the given status/headers/body; mode "abort" kills the connection so the app sees a network failure. Requires TLS capture to already be running on this device (android_traffic_start) — routes are stored per-device and take effect live, no restart needed. Certificate-pinned apps cannot be intercepted at all (same limit as capture itself), so a route targeting pinned traffic will simply never match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Route id to update in place (replaces the existing route); omit to auto-generate a new one | |
| body | No | Response body to inject for mode "mock" (text, or base64 when bodyEncoding is "base64") | |
| mode | No | "mock" injects a canned response (default); "abort" kills the connection | |
| method | No | Optional HTTP method filter (e.g. "GET"/"POST"); matches any method when omitted | |
| serial | Yes | Android device serial (adb serial) | |
| status | No | HTTP status to inject for mode "mock" (default 200) | |
| delayMs | No | Latency to inject before responding/aborting, in ms (clamped to 60s server-side) | |
| enabled | No | Whether the route is active (default true) — disabled routes are kept but ignored | |
| headers | No | Response headers to inject for mode "mock", as {headerName: value} — e.g. {"content-type": "application/json"} | |
| matchUrl | Yes | URL pattern to match against the request's full URL | |
| matchType | No | How matchUrl is interpreted against the request URL (default "contains") | |
| bodyEncoding | No | Encoding of `body` (default "text") |