fix: enable request interception when Fetch.enable is called (#50)

Fetch.enable was setting page.intercept_enabled to false and clearing
intercept_block_patterns, which caused should_block_url() to always
return false. As a result, Fetch.requestPaused events were never
triggered and Playwright's page.route() handlers never executed.

- Set intercept_enabled to true (was false)
- Propagate URL patterns to page.intercept_block_patterns (was cleared)

Fixes #49

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
pryceupandClaude Opus 4.7 authored and GitHub committed 2026-05-03 17:09:02 +02:00
1 parent 6f150065bc
commit 25b6d58f3e
1 file changed
+2 -2
+2 -2
View File
@@ -82,8 +82,8 @@ pub async fn handle(
ctx.fetch_intercept.patterns = patterns.clone();
let tx_clone = ctx.intercept_tx.clone();
if let Some(page) = ctx.get_session_page_mut(session_id) {
page.intercept_enabled = false;
page.intercept_block_patterns.clear();
page.intercept_enabled = true;
page.intercept_block_patterns = patterns.clone();
if let Some(tx) = tx_clone {
page.set_intercept_tx(tx);
}