playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] Downloads in Chromium do not use custom User-Agent

Open SteffenDE opened this issue 1 year ago • 1 comments

System info

  • Playwright Version: 1.33.0
  • Operating System: macOS
  • Browser: Chromium

Source code

Link to the GitHub repository with the repro

https://github.com/SteffenDE/playwright-download-ua-bug

Steps

  • Start the HTTP server using node server.js
  • Run playwright using npx playwright test --project chromium
  • See in the server log that the page request uses the configured User-Agent, but the download request does not

Expected

Downloads should use the configured User-Agent. This works when using Webkit and Firefox.

Actual

{
  host: '127.0.0.1:8080',
  connection: 'keep-alive',
  'upgrade-insecure-requests': '1',
  'user-agent': 'MyCustomUA',
  'accept-language': 'en-US',
  accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
  'sec-fetch-site': 'none',
  'sec-fetch-mode': 'navigate',
  'sec-fetch-user': '?1',
  'sec-fetch-dest': 'document',
  'accept-encoding': 'gzip, deflate, br'
}
{
  host: '127.0.0.1:8080',
  connection: 'keep-alive',
  'sec-fetch-site': 'same-origin',
  'sec-fetch-mode': 'navigate',
  'sec-fetch-dest': 'empty',
  referer: 'http://127.0.0.1:8080/',
  'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/113.0.5672.53 Safari/537.36',
  'accept-encoding': 'gzip, deflate, br'
}

SteffenDE avatar May 05 '23 08:05 SteffenDE

Upstream issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1447965

dgozman avatar May 23 '23 04:05 dgozman