• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Hire tech talent
    • Blog
    • Sales
    • Salary Calculator

0

265
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!