Skip to content

fix(playwright,puppeteer): only intercept requests for non-GET methods or payloads#3819

Open
barjin wants to merge 2 commits into
masterfrom
fix/goto-extended-header-interception
Open

fix(playwright,puppeteer): only intercept requests for non-GET methods or payloads#3819
barjin wants to merge 2 commits into
masterfrom
fix/goto-extended-header-interception

Conversation

@barjin

@barjin barjin commented Jul 3, 2026

Copy link
Copy Markdown
Member

gotoExtended() installed request interception (and logged a "high impact on performance" deprecation warning) for any GET request carrying custom headers, even though headers alone don't require rewriting - only non-GET methods and payloads do. Headers-only GETs now go through the native page.setExtraHTTPHeaders() instead, avoiding the page-lifetime interception overhead and the misleading warning.

Fixes #3799

barjin added 2 commits July 3, 2026 12:30
gotoExtended() installed page-lifetime request interception (and logged
a "high impact on performance" warning) for any GET request carrying
custom headers, even though headers alone don't require rewriting.
Apply headers-only GETs via page.setExtraHTTPHeaders() instead.
gotoExtended() enabled request interception (and logged a "high impact
on performance" warning) for any GET request carrying custom headers,
even though headers alone don't require rewriting. Apply headers-only
GETs via page.setExtraHTTPHeaders() instead.
@barjin barjin requested a review from Copilot July 3, 2026 10:58
@barjin barjin self-assigned this Jul 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes gotoExtended() in the Playwright and Puppeteer crawler utilities to avoid enabling request interception (and its deprecation/performance warning) for simple GET navigations that only specify custom headers, using native extra-header APIs instead.

Changes:

  • Update gotoExtended() to install interception only for non-GET methods or when a payload is present.
  • Apply headers-only GET requests via page.setExtraHTTPHeaders() (Playwright & Puppeteer).
  • Add regression tests asserting headers are applied for GET-with-headers without enabling interception or emitting the warning.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/playwright-crawler/src/internals/utils/playwright-utils.ts Restricts interception to non-GET/payload and uses native extra headers for headers-only GET.
packages/puppeteer-crawler/src/internals/utils/puppeteer_utils.ts Mirrors the Playwright change for Puppeteer’s gotoExtended().
test/core/playwright_utils.test.ts Adds coverage for headers-only GET using native header application (no routing).
test/core/puppeteer_utils.test.ts Adds coverage for headers-only GET using native header application (no interception).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playwright-crawler/src/internals/utils/playwright-utils.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gotoExtended installs request interception for any GET with custom headers

3 participants