Skip to content

Commit 2f458c1

Browse files
fix(network): trailing data in Network redirect chain (#1880)
Closes #1808
1 parent 49f46b3 commit 2f458c1

6 files changed

Lines changed: 14 additions & 7 deletions

File tree

docs/tool-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run gen' to update-->
22

3-
# Chrome DevTools MCP Tool Reference (~6963 cl100k_base tokens)
3+
# Chrome DevTools MCP Tool Reference (~6962 cl100k_base tokens)
44

55
- **[Input automation](#input-automation)** (9 tools)
66
- [`click`](#click)

src/bin/cliDefinitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export const commands: Commands = {
369369
},
370370
},
371371
list_pages: {
372-
description: 'Get a list of pages open in the browser.',
372+
description: 'Get a list of pages open in the browser.',
373373
category: 'Navigation automation',
374374
args: {},
375375
},

src/formatters/NetworkFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ function converNetworkRequestDetailedToStringDetailed(
316316
let indent = 0;
317317
for (const request of redirectChain.reverse()) {
318318
response.push(
319-
`${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)})}`,
319+
`${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)}`,
320320
);
321321
indent++;
322322
}

src/tools/pages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
export const listPages = defineTool(args => {
2020
return {
2121
name: 'list_pages',
22-
description: `Get a list of pages ${args?.categoryExtensions ? 'including extension service workers' : ''} open in the browser.`,
22+
description: `Get a list of pages${args?.categoryExtensions ? ' including extension service workers' : ''} open in the browser.`,
2323
annotations: {
2424
category: ToolCategory.NAVIGATION,
2525
readOnlyHint: true,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exports[`NetworkFormatter > toStringDetailed > handles redirect chain 1`] = `
2+
## Request http://example.com
3+
Status: pending
4+
### Request Headers
5+
- content-size:10
6+
### Redirect chain
7+
reqid=2 GET http://example.com/redirect [pending]
8+
`;

tests/formatters/NetworkFormatter.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ describe('NetworkFormatter', () => {
291291
assert.match(result, /"response":"body"/);
292292
});
293293

294-
it('handles redirect chain', async () => {
294+
it('handles redirect chain', async t => {
295295
const redirectRequest = getMockRequest({
296296
url: 'http://example.com/redirect',
297297
});
@@ -305,8 +305,7 @@ describe('NetworkFormatter', () => {
305305
redactNetworkHeaders: false,
306306
});
307307
const result = formatter.toStringDetailed();
308-
assert.match(result, /Redirect chain/);
309-
assert.match(result, /reqid=2/);
308+
t.assert.snapshot?.(result);
310309
});
311310
it('shows saved to file message in toStringDetailed', async () => {
312311
const request = {

0 commit comments

Comments
 (0)