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

168
Vistas
Axios get request from url

So I'm having an issue with the npm package axios when trying to make a get request to a URL. I get an error code 503 every time; this is my code:

let data, response;

response = await axios.get(url, {
    headers: {
        Accept: 'application/json',
    }
})

So at first, I thought I did something wrong with the code (like changing Accept to 'Accept'), but when I do the exact same thing on Postman, it returns just fine.

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

So I tried by changing the User-Agent option in the headers to the one from Postman, and now it just seems to be working.

let data, response;

response = await axios.get(url, {
    headers: {
        'Accept': 'application/json',
        'User-Agent': 'PostmanRuntime/7.28.4',
    }
});

I'm still a bit new to http requests, so I really don't understand how this happens. I'm using axios in other cases with different URL's too and there everything just runs fine.

about 4 years ago · Santiago Gelvez 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