Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!