Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

281
Visualizações
How to obtain generated cookies from a request with axios?

So, when I make a GET request in postman, in the response, one cookie was generated. I am trying to do this request with axios in Node.js. However, I am not able to get this generated cookie.

I am using axios interceptors like:

axios.interceptors.response.use(function (response) {
  console.log(response.headers);
  return response;
  }, function (error) {
  return Promise.reject(error);
});

But, it only returns:

{
  'cache-control': 'private',
  'content-type': 'text/html',
  expires: 'Tue, 01 Mar 2022 19:53:24 GMT',
  server: 'Microsoft-IIS/8.5',
  'x-powered-by': 'ASP.NET',
  date: 'Tue, 01 Mar 2022 19:53:23 GMT',
  'content-length': '4067'
}

I make the request like this

var config = {
  method: 'get',
  url: 'example.com',
  headers: { 
    'Cookie': 'ASPSESSIONIDAWSQAQSA=AKLJADOCJNNPPHOKGGMOPHJD'
  }
};

axios(config)
.then(function (response) {
  //console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

There are more things in the header. But I just took it out to make it less verbose.

In the headers, there is no information about the cookie that is being generated. The problem is that I need this cookie to make other requests in the website.

In the request I already add one cookie like

{
'Cookie': 'ASPSESSIONIDAWSQAQSA=AKLJADOCJNNPPHOKGGMOPHJD',
'Connection': 'keep-alive'
}

But I need the new cookie that is generated in the response. Therefore, the next request that I do will have two cookies.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda