This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($httpBackend): Allow status code 0 from any protocol
Android 4.1 stock browser also returns status code 0 when a template is loaded via `http` and the application is cached using appcache. Fixes #1356. Closes #5547.
- Loading branch information
Showing
2 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28fc80b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Altering status 0 to 404 may seem like the right thing to do in some scenarios but it is not a good solution overall as 404 is a HTTP response code and indicates that the server did actually respond. Status 0 should, according to w3.org definition, be considered "some type of network error or fetch termination" (http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute) - very different to the meaning of status 404 - "Not found"
I discovered this code change after upgrading to latest version of angularjs - my code which handles network/connection problems based on status code 0 stopped working since status 0 is now mapped to 404.
28fc80b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you mean we should leave statusCode 0 as it is if it represents an error, right? However, in the success case we do want to convert it into a statusCode 200 (e.g. needed for reading a file which will always set statusCode 0, or when using the appCache on Android).
Could you create an issue for this?
28fc80b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#6155