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

88
Vistas
Intercepting XMLHttpRequest and setRequestHeader appending values

I am trying to use the below code to intercept some AJAX calls from my app (which uses both axios and fetch).

(function(send) {
        XMLHttpRequest.prototype.send = function(data) {
            this.setRequestHeader('someHeader', 'ABC');
            send.call(this, data);
        };
    })(XMLHttpRequest.prototype.send);

However, each execution of this line setRequestHeader seems to be appending the values and setting in the header.

E.g. if I have 3 AJAX calls on my page, for the 3rd request, I see "user" header value as "ABC ABC ABC"

Not sure if the above way is correct ?

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