browser icon indicating copy to clipboard operation
browser copied to clipboard

How to get response headers

Open wh5938316 opened this issue 5 months ago • 1 comments

The return value of await page.goto is null. If I want to get the response headers of that website's document, how should I do it?

const response = await page.goto(url, { waitUntil: 'load', timeout: timeout });

// echo `null`
console.log(response);

// I want to get headers
const headers = response.headers();

I'm sure it's not due to a timeout, because the subsequent page.evaluate will execute normally.

wh5938316 avatar Nov 28 '25 10:11 wh5938316

Hello @wh5938316, thanks for the issue. What library are you using? playwright?

krichprollsch avatar Nov 28 '25 10:11 krichprollsch

I'm using puppeteer@^24.4.0; I haven't tried Playwright.

wh5938316 avatar Dec 01 '25 01:12 wh5938316