Skip to content

[BUG] request headers missing when using page.route() #18027

Open

Description

Context:

  • Playwright Version: 1.27.0
  • Operating System: Mac
  • Node.js version: 16.16.0
  • Browser: Chromium

Code Snippet

(async () => {
  const url = 'https://developer.mozilla.org/en-US/';
  
  // Without page.route()
  const browser1 = await chromium.launch();
  const context1 = await browser1.newContext({ recordHar: { omitContent: false, path: './har-file-no-route' } });
  const page1 = await context1.newPage()

  page1.on('request', async (req) => {
    console.log(await req.allHeaders());
  })

  await page1.goto(url);

  await page1.close();
  await context1.close();
  await browser1.close();



  // With page.route()
  const browser2 = await chromium.launch();
  const context2 = await browser2.newContext({ recordHar: { omitContent: false, path: './har-file-with-route' } });
  const page2 = await context2.newPage()

  page2.on('request', async (req) => {
    console.log(await req.allHeaders());
  })

  page2.route('**/*', async (route) => {
    route.continue();
  });

  await page2.goto(url);

  await page2.close();
  await context2.close();
  await browser2.close();
})();

Describe the bug
When using page.route() there are missing request headers, potentially related to #6690? The headers are all there and correctly returned when using firefox instead of chromium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions