mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 08:17:11 +00:00
fix(browser): log only matched intercepted requests (#1366)
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user