Network

intercept

Intercept network requests: block URLs, mock responses from files, or inject custom headers.

Usage

$ cdpilot intercept <subcmd> [args...]

Arguments

NameRequiredDescription
subcmdrequiredblock <pattern>, mock <pattern> <json-file>, headers <pattern> <header:value>, clear, or list

Examples

Block all analytics requests

$ npx cdpilot intercept block "*.analytics.com*"

Mock an API endpoint with a local JSON file

$ npx cdpilot intercept mock "*/api/users" ./mock-users.json

Add a custom header to all requests

$ npx cdpilot intercept headers "*" "X-Debug:true"

Show active interception rules

$ npx cdpilot intercept list

Remove all interception rules

$ npx cdpilot intercept clear