pilot_intercept
Intercept network requests matching a URL pattern to mock API responses, simulate error states (401, 500), or test loading states. Customize status, headers, and body for frontend testing without a real backend.
Instructions
Intercept network requests matching a URL pattern and respond with custom status, headers, and body. Use when the user wants to mock API responses, simulate error states (401, 500), test loading states, or run frontend tests without a real backend. All requests matching the pattern are fulfilled with the given response until cleared.
Parameters:
pattern: URL glob pattern to intercept (e.g., "**/api/users", "/auth")
response: Custom response — status (default 200), body (JSON string or text), headers, contentType
clear: Set to true to remove all active intercepts
Returns:
Add mode: Confirmation and list of active intercepts.
clear mode: Confirmation that all intercepts were removed.
Errors:
"Browser not launched": Navigate to a URL first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | No | URL glob pattern to intercept (e.g., "**/api/users") | |
| response | No | Custom response to return for matched requests | |
| clear | No | Remove all active intercepts |