Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda