(js) Limit http error interceptor to JSON request

This commit is contained in:
Francis Lachapelle 2017-03-01 16:31:36 -05:00
parent c995c6e9d7
commit c8539dffa1

View file

@ -260,6 +260,7 @@
return {
responseError: function(rejection) {
var deferred, iframe;
if (/^application\/json/.test(rejection.config.headers.Accept)) {
// Handle CAS ticket renewal (TODO: add check on usesCASAuthentication)
if (rejection.status == -1) {
deferred = $q.defer();
@ -274,12 +275,11 @@
return deferred.promise;
}
else {
if (/^application\/json/.test(rejection.config.headers.Accept)) {
// Broadcast the response error
$rootScope.$broadcast('http:Error', rejection);
}
return $q.reject(rejection);
}
return $q.reject(rejection);
}
};
}