intercept_network
Intercept network requests matching a URL pattern and return custom HTTP responses to test error, empty, and loading states without a real backend.
Instructions
Mock API responses on a session. Intercept requests matching a URL pattern and return custom responses. Use to test error states, empty states, loading states without needing the real backend. Call BEFORE the action that triggers the request.
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 | URL substring to match (e.g. '/api/tasks', 'graphql') | |
| content_type | No | Content-Type header (default: 'application/json') |