Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

433
Views
Remove some cookie from ajax call with Axios

I use Axios in browser to call ajax request. Now I have a problem with some cookie that has high priority than some header. Per request I send a header as AUTHTOKEN but in cookie SESSIONID key stored that high priority than AUTHTOKEN header. In some scenario, I need to ignore cookie. This is my code:

axios({
    url:`${sdpBasicUrl}/api/v3/requests/27363`,
    method: 'get',
    headers: {
        'Content-Type': 'application/json'  
        'AUTHTOKEN': 'GHG23847923HGJ'               
    }
})
.then(res => {
    console.log(res.data);
});

and this is cookie sample:

_z_identity=true; PORTALID=1; csrfcookie=aasdasdjh24234b2bjh4hjl; SESSIONID=ffd68d32a14841c99905e3cf4897e15ec9b4777020854a76821fd7e1eab6db2dcab482eb4cfea2ce7f5a6c47c80271d09f608ed985004e5c85681b2939681b18

What should I do? Do you have any solution to solve my problem?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You are able to pass in cookies through the header like this:

Axios.request({
     url: "http://example.com",
     method: "get",
     headers:{
         Cookie: "cookie1=value; cookie2=value; cookie3=value;"
     } 
}).then...

So if you don't want the value to be there, you could override the values.

https://github.com/axios/axios/issues/943

over 4 years ago · Santiago Trujillo Report

0

You can use transformRequest to modify the header for some requests. transformRequest allows changes to the request data and header before it is sent to the server. This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'.

transformRequest: [function (data, headers) {
    // Modify the header here and return the header
    return data;
}],

You can get more information about it on https://axios-http.com/docs/req_config

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

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