angular/angular.js — pull request #7688 by caitp (2014-06-04 01:36:57+00:00)
Title: fix($http): reject $http promise when timeout occurs

Previously, timed out $http requests would result in a fulfilled promise,
rather than a rejection. This CL corrects this unexpected behaviour.

BREAKING CHANGE:

Currently, request timeout is treated as a successful request. This is
unexpected, as a timeout is generally a failure, however it's possible some
applications depend on this behaviour.

If your application depends on this, it's possible to migrate by simply moving
the code which handles a timeout into a rejection/error handler, rather than a
success handler.

Example:

$http.get('/some/slow/resource', {
timeout: 1
}).error(function(res) {
if (res.statusText === "Timedout") {
console.log("request timed out!");
}
});