fix: use async response status for network request list and detail views - #18
Open
AlanJie wants to merge 1 commit into
Open
fix: use async response status for network request list and detail views#18AlanJie wants to merge 1 commit into
AlanJie wants to merge 1 commit into
Conversation
`getShortDescriptionForRequest` and `getStatusFromRequest` in the list/detail views were synchronous but Playwright's `request.response()` is async, so all requests showed `[pending]` even after the page finished loading. Requests where `request.failure()` was set (e.g. beacon/analytics) also showed `[failed - net::ERR_ABORTED]` even though they completed successfully. Add `getShortDescriptionForRequestAsync` that calls the existing `getStatusFromRequestAsync`, and wire it into `McpResponse.format()` and `#formatNetworkRequestData()` so list, detail, and redirect-chain views all show the real HTTP status code. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list_network_requestslist and single-request detail views always showed[pending], even after the page finished loading[failed - net::ERR_ABORTED]when they actually returned HTTP 200Root Cause
getShortDescriptionForRequestandgetStatusFromRequestinnetworkFormatter.tsare synchronous, but Playwright'srequest.response()is async. The sync path can never obtain the real response status:An async version
getStatusFromRequestAsyncalready existed but was never called by the list or detail formatting code.Fix
src/formatters/networkFormatter.ts— AddedgetShortDescriptionForRequestAsync, which calls the existinggetStatusFromRequestAsyncsrc/McpResponse.ts— Updated 3 call sites to use the async versions:format())#formatNetworkRequestData())#formatNetworkRequestData())format()and#formatNetworkRequestData()method signatures changed toasyncBefore / After
GET .../api/feed/topstory/recommend ... [pending]GET .../api/feed/topstory/recommend ... [success - 200]POST .../za/logs/batch [failed - ERR_ABORTED]POST .../za/logs/batch [success - 200]Status: [pending]Status: [success - 200]🤖 Generated with Claude Code