Is it possible to access / modify $http
interceptors after the config phase? I'm debugging an app that only breaks in production due to being deployed on a different server, so unfortunately I can't change the interceptor code locally and figure out what's going on.
If it's not possible to access / modify the interceptors, perhaps it'd be possible to replace $http
. Here's an example of replacing a hypothetical service:
var inj = angular.element('body').injector(),
oldGet = inj.get,
mockService = { secret: 'shhh' };
inj.get = function(str) {
if (str === 'some-service') {
return mockService;
} else {
return oldGet.apply(inj, arguments);
}
};
However, I'm not sure how I'd go about creating a new $http
service (into which I could pass in the modified interceptors). I can't grab the $httpProvider
, either.
Perhaps bootstrapping a new ng-app
on a separate part of the page would work? Then I could grab the $http
service and replace it, like above.
Other ideas:
- With reference to: Right way to disable/remove http interceptors in Angular? , it does not seem like I can access the interceptors array if I don't hold on to it in the config phase.
- Perhaps I can use grease monkey to inject something that runs in the config phase.
Thank you!