Chrome DevTools for coding agents
fix(network): trailing data in Network redirect chain (#1880)
Nikolay Vitkov2f458c11ebbb
diff --git a/docs/tool-reference.md b/docs/tool-reference.mdindex b280987a..366c21ea 100644--- a/docs/tool-reference.md+++ b/docs/tool-reference.md@@ -1,6 +1,6 @@<!-- AUTO GENERATED DO NOT EDIT - run 'npm run gen' to update-->-# Chrome DevTools MCP Tool Reference (~6963 cl100k_base tokens)+# Chrome DevTools MCP Tool Reference (~6962 cl100k_base tokens)- **[Input automation](#input-automation)** (9 tools)- [`click`](#click)diff --git a/src/bin/cliDefinitions.ts b/src/bin/cliDefinitions.tsindex a3b5e5cf..aef789af 100644--- a/src/bin/cliDefinitions.ts+++ b/src/bin/cliDefinitions.ts@@ -369,7 +369,7 @@ export const commands: Commands = {},},list_pages: {- description: 'Get a list of pages open in the browser.',+ description: 'Get a list of pages open in the browser.',category: 'Navigation automation',args: {},},diff --git a/src/formatters/NetworkFormatter.ts b/src/formatters/NetworkFormatter.tsindex 9e21d2c6..10e2069d 100644--- a/src/formatters/NetworkFormatter.ts+++ b/src/formatters/NetworkFormatter.ts@@ -316,7 +316,7 @@ function converNetworkRequestDetailedToStringDetailed(let indent = 0;for (const request of redirectChain.reverse()) {response.push(- `${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)})}`,+ `${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)}`,);indent++;}diff --git a/src/tools/pages.ts b/src/tools/pages.tsindex 9cc776c8..40155934 100644--- a/src/tools/pages.ts+++ b/src/tools/pages.ts@@ -19,7 +19,7 @@ import {export const listPages = defineTool(args => {return {name: 'list_pages',- description: `Get a list of pages ${args?.categoryExtensions ? 'including extension service workers' : ''} open in the browser.`,+ description: `Get a list of pages${args?.categoryExtensions ? ' including extension service workers' : ''} open in the browser.`,annotations: {category: ToolCategory.NAVIGATION,readOnlyHint: true,diff --git a/tests/formatters/NetworkFormatter.test.js.snapshot b/tests/formatters/NetworkFormatter.test.js.snapshotnew file mode 100644index 00000000..1de0501d--- /dev/null+++ b/tests/formatters/NetworkFormatter.test.js.snapshot@@ -0,0 +1,8 @@+exports[`NetworkFormatter > toStringDetailed > handles redirect chain 1`] = `+## Request http://example.com+Status: pending+### Request Headers+- content-size:10+### Redirect chain+reqid=2 GET http://example.com/redirect [pending]+`;diff --git a/tests/formatters/NetworkFormatter.test.ts b/tests/formatters/NetworkFormatter.test.tsindex a8fad2c2..3ff5b5d7 100644--- a/tests/formatters/NetworkFormatter.test.ts+++ b/tests/formatters/NetworkFormatter.test.ts@@ -291,7 +291,7 @@ describe('NetworkFormatter', () => {assert.match(result, /"response":"body"/);});- it('handles redirect chain', async () => {+ it('handles redirect chain', async t => {const redirectRequest = getMockRequest({url: 'http://example.com/redirect',});@@ -305,8 +305,7 @@ describe('NetworkFormatter', () => {redactNetworkHeaders: false,});const result = formatter.toStringDetailed();- assert.match(result, /Redirect chain/);- assert.match(result, /reqid=2/);+ t.assert.snapshot?.(result);});it('shows saved to file message in toStringDetailed', async () => {const request = {