intercept_network
Mock API responses by intercepting requests matching a URL substring. Return custom status, body, and content-type to simulate error, empty, or loading states without a backend.
Instructions
Mock matching API responses on a session — return a custom status/body/content-type for requests whose URL contains a substring. Returns {success}. Use it to force error, empty, or loading states without a real backend; call BEFORE the triggering action, and clear_intercepts to remove. once=true intercepts only the first match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Response body (JSON string or plain text) | |
| once | No | Only intercept the first matching request (default: false) | |
| method | No | HTTP method filter (optional, e.g. 'GET', 'POST') | |
| status | No | HTTP status code to return (default: 200) | |
| session_id | Yes | Session ID | |
| url_pattern | Yes | Plain substring of the full URL to match (e.g. '/api/tasks', 'graphql') — not a regex or glob. | |
| content_type | No | Content-Type header (default: 'application/json') |