Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($http): propagate status -1 for aborted requests #8756

Closed

Conversation

pkozlowski-opensource
Copy link
Member

Fixes #4491

@pkozlowski-opensource pkozlowski-opensource changed the title fix(): propagate status -1 for aborted requests fix($http): propagate status -1 for aborted requests Aug 24, 2014
@jeffbcross jeffbcross self-assigned this Sep 3, 2014
@jeffbcross jeffbcross added this to the 1.3.0 milestone Sep 3, 2014
@jeffbcross jeffbcross removed their assignment Sep 3, 2014
@jeffbcross jeffbcross force-pushed the master branch 2 times, most recently from cad9560 to f294244 Compare October 2, 2014 22:09
@jeffbcross jeffbcross force-pushed the master branch 4 times, most recently from e8dc429 to e83fab9 Compare October 10, 2014 17:38
@gabrielmaldi
Copy link
Contributor

Can I help with something to make this PR move forward?

@petebacondarwin
Copy link
Contributor

LGTM

@dizel3d
Copy link
Contributor

dizel3d commented Dec 22, 2015

Why this feature was introduced as patch for Angular 1.3.x? I think it is a breaking change and should be introduced in Angular 1.4.x. because many developers use 0 instead of -1. proof.

@petebacondarwin
Copy link
Contributor

@dizel3d - thanks for getting in touch. The status of an error was not defined as a public API in the Angular docs. The reason we used to (incorrectly) return 0 for all errors was that browsers were inconsistent in their error return values.
What we guarantee, which has not changed, is that successful requests would return a value between 200 and 299, inclusive.
To tell if a request errored, you should really be using an error handler via then(successFn, errorFn). What this added was a way of telling if the error was because of a timeout.
If you must use the status to check for an error, then perhaps you should test for <=0 rather than ==0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix($http) Indicate whether a request was aborted via status.
6 participants