Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to get HTTP response headers with nodejs and puppeteer?

enter image description here

Hi there,

is there any possible way to get the server information like the above by using nodejs and puppeteer?

many thanks

like image 872
Bill Avatar asked Feb 28 '19 23:02

Bill


People also ask

Can Javascript read response headers?

While you can't ready any headers of HTML response in JS, you can read Server-Timing header, and you can pass arbitrary key-value data through it.

Does HTTP response have headers?

A response header is an HTTP header that can be used in an HTTP response and that doesn't relate to the content of the message. Response headers, like Age , Location or Server are used to give a more detailed context of the response.

What is HTTP header in node JS?

The header tells the server details about the request such as what type of data the client, user, or request wants in the response. Type can be html , text , JSON , cookies or others.


1 Answers

These are the response headers, which you can get with response.headers():

const response = await page.goto(url);
const headers = response.headers();
console.log(headers);
like image 166
Thomas Dondorf Avatar answered Sep 18 '22 12:09

Thomas Dondorf