Added support for ignoring HTTP errors directly from the Angular $http options

This commit is contained in:
Anders Bjerner
2017-02-16 19:22:26 +01:00
committed by GitHub
parent acf10eeef0
commit ad9ae867c0

View File

@@ -22,7 +22,7 @@ angular.module('umbraco.security.interceptor')
//Here we'll check if we should ignore the error, this will be based on an original header set
var headers = originalResponse.config ? originalResponse.config.headers : {};
if (headers["x-umb-ignore-error"] === "ignore") {
if (headers["x-umb-ignore-error"] === "ignore" || originalResponse.config.umbIgnoreErrors === true) {
//exit/ignore
return promise;
}
@@ -99,4 +99,4 @@ angular.module('umbraco.security.interceptor')
// We have to add the interceptor to the queue as a string because the interceptor depends upon service instances that are not available in the config block.
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.responseInterceptors.push('securityInterceptor');
}]);
}]);