Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

224
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda