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

504
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
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