From c8539dffa130b4aad0f412894521e8733eeb871b Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 1 Mar 2017 16:31:36 -0500 Subject: [PATCH] (js) Limit http error interceptor to JSON request --- UI/WebServerResources/js/Common/Common.app.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/UI/WebServerResources/js/Common/Common.app.js b/UI/WebServerResources/js/Common/Common.app.js index 3a1371e0e..9ed33ce9b 100644 --- a/UI/WebServerResources/js/Common/Common.app.js +++ b/UI/WebServerResources/js/Common/Common.app.js @@ -260,26 +260,26 @@ return { responseError: function(rejection) { var deferred, iframe; - // Handle CAS ticket renewal (TODO: add check on usesCASAuthentication) - if (rejection.status == -1) { - deferred = $q.defer(); - iframe = angular.element(''); - iframe.on('load', function() { - // Once the browser has followed the redirection, send the initial request - var $http = $injector.get('$http'); - $http(rejection.config).then(deferred.resolve, deferred.reject); - iframe.remove(); - }); - document.body.appendChild(iframe[0]); - return deferred.promise; - } - else { - if (/^application\/json/.test(rejection.config.headers.Accept)) { + if (/^application\/json/.test(rejection.config.headers.Accept)) { + // Handle CAS ticket renewal (TODO: add check on usesCASAuthentication) + if (rejection.status == -1) { + deferred = $q.defer(); + iframe = angular.element(''); + iframe.on('load', function() { + // Once the browser has followed the redirection, send the initial request + var $http = $injector.get('$http'); + $http(rejection.config).then(deferred.resolve, deferred.reject); + iframe.remove(); + }); + document.body.appendChild(iframe[0]); + return deferred.promise; + } + else { // Broadcast the response error $rootScope.$broadcast('http:Error', rejection); } - return $q.reject(rejection); } + return $q.reject(rejection); } }; }