(js) Limit http error interceptor to JSON request
This commit is contained in:
parent
c995c6e9d7
commit
c8539dffa1
|
@ -260,6 +260,7 @@
|
||||||
return {
|
return {
|
||||||
responseError: function(rejection) {
|
responseError: function(rejection) {
|
||||||
var deferred, iframe;
|
var deferred, iframe;
|
||||||
|
if (/^application\/json/.test(rejection.config.headers.Accept)) {
|
||||||
// Handle CAS ticket renewal (TODO: add check on usesCASAuthentication)
|
// Handle CAS ticket renewal (TODO: add check on usesCASAuthentication)
|
||||||
if (rejection.status == -1) {
|
if (rejection.status == -1) {
|
||||||
deferred = $q.defer();
|
deferred = $q.defer();
|
||||||
|
@ -274,12 +275,11 @@
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (/^application\/json/.test(rejection.config.headers.Accept)) {
|
|
||||||
// Broadcast the response error
|
// Broadcast the response error
|
||||||
$rootScope.$broadcast('http:Error', rejection);
|
$rootScope.$broadcast('http:Error', rejection);
|
||||||
}
|
}
|
||||||
return $q.reject(rejection);
|
|
||||||
}
|
}
|
||||||
|
return $q.reject(rejection);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue