K
K
kpkkk4232020-04-28 16:46:54
JavaScript
kpkkk423, 2020-04-28 16:46:54

How to get Request Headers?

How to get Request Headers via javascript in the console
5ea83637879a0076091732.png
, I want to get them in the console

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ineshin, 2020-04-28
@IonDen

In theory:

fetch('url', {
      method: "GET",
    }).then(function(response) {
      console.log(response.status);
      console.log(response.statusText);
      console.log(response.headers);    //=> Headers
      console.log(response.url);
    }, function(error) {
      console.log(error.message);
    })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question