文件历史

提交图

8 次代码提交

作者 SHA1 备注 提交日期
nyxst4ck 5a9d6af743 fix(network): keep redirect chain order consistent between text and JSON (#2221)
## Problem

`get_network_request` returns, from the **same call**, both a
human-readable
text block (`toStringDetailed()`) and a
`structuredContent.networkRequest`
object (`toJSONDetailed()`) — emitted together in `McpResponse.ts`. For
a
request that went through HTTP redirects, the redirect chain comes out
in
**opposite orders** in the two representations:

- `toJSONDetailed()` (`NetworkFormatter.ts`) reverses `redirectChain()`
once →
  newest→oldest in the JSON.
- the text formatter then reverses it **a second time** → oldest→newest
in the
  text.

Because each path calls `redirectChain()` separately and Puppeteer
returns a
fresh copy on every call (`HTTPRequest#redirectChain()` does
`this._redirectChain.slice()`), the two reverses operate on different
arrays and
don't cancel. So a consumer reading the text and a consumer parsing the
structured JSON from the same response see contradictory redirect
orders.

## Solution

Drop the redundant `.reverse()` in the text formatter so the rendered
text uses
the order already produced by `toJSONDetailed()`. Both representations
are now
consistent (newest→oldest), and `structuredContent` is unchanged.

## Why the existing tests didn't catch it

- The existing "handles redirect chain" test uses a **single-element**
chain,
  where reversing is a no-op.
- `getMockRequest().redirectChain()` returned the **same array
reference** on
every call, unlike real Puppeteer — so the two reverses accidentally
agreed in
tests. This PR makes the mock return a fresh copy per call (matching
Puppeteer)
and adds a regression test with a multi-element chain that asserts the
text and
  JSON orders match.

## Testing

- `npm test` for the formatter suite passes. New test
`renders the redirect chain in the same order in text and JSON` is
**red**
before the fix (text `[first, second]` vs JSON `[second, first]`) and
**green**
  after, with no change to existing snapshots.
- `npm run typecheck` and Prettier/ESLint are clean.

No existing issue tracked this; found via code inspection and confirmed
empirically.
2026-06-18 17:18:14 +00:00
Alex Rudenko f8fb2a9236 test: drop node20 code in tests (#2146) 2026-05-27 11:12:22 +00:00
Nikolay Vitkov 2f458c11eb fix(network): trailing data in Network redirect chain (#1880)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/1808
2026-04-17 12:19:46 +00:00
Alex Rudenko 5c398c4e7c feat: support DevTools header redactions as an option (#1848)
This PR adds a CLI flag to enable redacting network headers in the same
way they are redacted in DevTools. Note that sometimes it might prevent
the agent from properly analysing network issues. Pass
`--redact-headers=false` to revert to the previous behavior.
2026-04-14 13:21:11 +00:00
Nikolay Vitkov 327a3884d8 refactor: remove text from the status code for Network requests (#778)
LLM are trained to know the common status code so we can rely on that
when displaying the status code and fall back to text in case of errors
or pending reponse.
2026-02-18 14:23:26 +00:00
Alex Rudenko 695817f6d6 fix: make request and response handling more robust (#846)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/842
2026-01-27 12:35:47 +00:00
Alex Rudenko 6d0e4cab28 feat: support filePath for network request and response bodies (#795)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/377
2026-01-19 12:44:59 +00:00
Alex Rudenko 755eeef3af chore: support structured network (#774)
This PR adds a structured variant of the network responses and refactors
the code accordingly.
2026-01-15 11:59:00 +00:00