豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit aa22e94

Browse files
Remove the status text
1 parent 1896dbb commit aa22e94

File tree

5 files changed

+69
-73
lines changed

5 files changed

+69
-73
lines changed

src/formatters/NetworkFormatter.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,11 @@ export class NetworkFormatter {
183183
const failure = request.failure();
184184
let status: string;
185185
if (httpResponse) {
186-
const responseStatus = httpResponse.status();
187-
status =
188-
responseStatus >= 200 && responseStatus <= 299
189-
? `[success - ${responseStatus}]`
190-
: `[failed - ${responseStatus}]`;
186+
status = httpResponse.status().toString();
191187
} else if (failure) {
192-
status = `[failed - ${failure.errorText}]`;
188+
status = failure.errorText;
193189
} else {
194-
status = '[pending]';
190+
status = 'pending';
195191
}
196192
return status;
197193
}
@@ -231,7 +227,7 @@ function convertNetworkRequestConciseToString(
231227
data: NetworkRequestConcise,
232228
): string {
233229
// TODO truncate the URL
234-
return `reqid=${data.requestId} ${data.method} ${data.url} ${data.status}${data.selectedInDevToolsUI ? ` [selected in the DevTools Network panel]` : ''}`;
230+
return `reqid=${data.requestId} ${data.method} ${data.url} [${data.status}]${data.selectedInDevToolsUI ? ` [selected in the DevTools Network panel]` : ''}`;
235231
}
236232

237233
function formatHeadlers(headers: Record<string, string>): string[] {

tests/McpContext.test.js.snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`McpContext > should include detailed network request in structured cont
44
"requestId": 456,
55
"method": "GET",
66
"url": "http://example.com/detail",
7-
"status": "[pending]",
7+
"status": "pending",
88
"requestHeaders": {
99
"content-size": "10"
1010
}
@@ -37,7 +37,7 @@ exports[`McpContext > should include network requests in structured content 1`]
3737
"requestId": 123,
3838
"method": "GET",
3939
"url": "http://example.com/api",
40-
"status": "[pending]",
40+
"status": "pending",
4141
"selectedInDevToolsUI": false
4242
}
4343
]

0 commit comments

Comments
 (0)