playwright-cli route mocks support URL patterns and route management
Introduced 2026-02-04 · score 0.98
HOW TO USE IT
When you need frontend development or testing without a backend, use `playwright-cli route` to mock requests by URL pattern, then use `route-list` or `unroute` to manage routes.
playwright-cli route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/jsonplaywright-cli route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"playwright-cli route-list
playwright-cli unroute "<URL pattern>"
playwright-cli unrouteWHY THIS HELPS
Mock backend responses while developing or testing a web application's frontend.
REQUIREMENTS AND LIMITATIONS
- Version: v0.0.63
- <pattern> (required): URL pattern to match; examples include `**/api/users`, `**/api/*/details`, `**/*.{png,jpg,jpeg}`, and `**/search?q=*`.
- --status: HTTP status code for the mock response; release example uses `404`.
- --body: Response body, such as a JSON string.
- --content-type: Content type for the response, such as `application/json`.
- --header: Custom header in `Name: Value` format.
- --remove-header: Comma-separated request headers to strip, such as `cookie,authorization`.
- unroute <pattern>: Remove routes matching a URL pattern; omit the pattern to remove all routes.
- Routes target URL patterns; the spans describe glob-style pattern support.
FIRST-PARTY EVIDENCE
Check the installed version and the source before using it. Entry JSON