puppeteer: request.headers() does not give all headers that are used when making the request
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.on('request', async (request) => {
await request.headers();
});
await page.goto('http://gajus.com');
just gives:
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/79.0.3945.0 Safari/537.36',
'sec-fetch-user': '?1'
whereas the actual headers include additional headers such as: accept, accept-language and accept encoding.
Related:
- https://github.com/puppeteer/puppeteer/issues/3436 (closed without a solution)
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 18
- Comments: 17 (1 by maintainers)
not stale, still
Any updates on this?
Even if this is not practicable to fix, it is at the very least a documentation bug in that the documentation says the headers are listed, not a random sub-set of the headers.
Still not stale
Not stale
We’re marking this issue as unconfirmed because it has not had recent activity and we weren’t able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.
Not stale
We’re marking this issue as unconfirmed because it has not had recent activity and we weren’t able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.
Workaround: create a CDP session and listen for network events: https://stackoverflow.com/a/62232903