You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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.
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.
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).
3 commit comments
geirgp commentedon Feb 4, 2014
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.
tbosch commentedon Feb 4, 2014
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?
swallez commentedon Feb 6, 2014
#6155