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

222
Vistas
What are the Angular Http Request status codes 0 and -1?

While checking out logs for a production app I noticed many failed HTTP requests with responses containing the status codes of 0 and -1. What is the difference between the status codes 1 and 0?

I know these are not 'real' status codes as per the http spec so I was trying to find the difference between these codes so I could at least notify the user that something is wrong with a message like 'Unable to connect to server' or something similar.

Angular.io seems to be devoid of documentation about these but I was able to find this on the legacy angular documentation:

Also, status codes less than -1 are normalized to zero. -1 usually means the request was aborted, e.g. using a config.timeout

Does the same also apply to the newer versions of Angular? I am using Angular 4.0.1.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I'm looking for the same answer, but what I know for sure, is that if your angular app could not get response from the server, it will set status code 0 or -1 (because a http-status code is received from a server).

I noticed that status -1 is used for timed out calls and if the real request has not been sent (e.g. the preflight options request failed - due to no internet or CORS issues).

I'm not sure when the status 0 returns, but I've encountered it already. I don't know if those two statuses have been mixed throughout the releases of Angular.

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