fix(playwright,puppeteer): only intercept requests for non-GET methods or payloads#3819
Open
barjin wants to merge 2 commits into
Open
fix(playwright,puppeteer): only intercept requests for non-GET methods or payloads#3819barjin wants to merge 2 commits into
barjin wants to merge 2 commits into
Conversation
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.
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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