fix(browser): log only matched intercepted requests (#1366)

This commit is contained in:
Kai (Tam Nhu) Tran
2026-05-23 21:44:40 -04:00
committed by GitHub
parent 2188cdc990
commit 8b3ba5532e
2 changed files with 13 additions and 12 deletions
+12 -10
View File
@@ -5097,16 +5097,18 @@ async function ensureInterceptSession(page) {
})
);
}
pushRecentRequest({
requestId: String(paused.requestId || ''),
pageId: page.id,
url: String(paused.request?.url || ''),
method: String(paused.request?.method || ''),
resourceType: String(paused.resourceType || ''),
matchedRuleId: matchedRule ? matchedRule.ruleId : '',
action,
statusCode: action === 'fulfill' ? matchedRule.statusCode : 0,
});
if (matchedRule) {
pushRecentRequest({
requestId: String(paused.requestId || ''),
pageId: page.id,
url: String(paused.request?.url || ''),
method: String(paused.request?.method || ''),
resourceType: String(paused.resourceType || ''),
matchedRuleId: matchedRule.ruleId,
action,
statusCode: action === 'fulfill' ? matchedRule.statusCode : 0,
});
}
})();
activityChain = activityChain
.catch(() => {})
@@ -780,8 +780,7 @@ describe('ccs-browser MCP server - session and interception', () => {
expect(listText).toContain('requestId: req-1');
expect(listText).toContain('matchedRuleId: rule-1');
expect(listText).toContain('action: fail');
expect(listText).toContain('requestId: req-2');
expect(listText).toContain('action: continue');
expect(listText).not.toContain('requestId: req-2');
});
it('removes rules and recent requests bound to a page after that page is closed', async () => {