diff options
| -rw-r--r-- | src/service/http.js | 1 | ||||
| -rw-r--r-- | test/service/httpSpec.js | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/service/http.js b/src/service/http.js index 92b95f35..23f33fad 100644 --- a/src/service/http.js +++ b/src/service/http.js @@ -343,6 +343,7 @@ function $HttpProvider() { rawRequest = $httpBackend(cfg.method, cfg.url, data, done, headers, cfg.timeout); } + $rootScope.$broadcast('$http.request', self); $http.pendingRequests.push(self); return this; }; diff --git a/test/service/httpSpec.js b/test/service/httpSpec.js index 11165adc..12921992 100644 --- a/test/service/httpSpec.js +++ b/test/service/httpSpec.js @@ -686,6 +686,16 @@ describe('$http', function() { }); + it('should broadcast $http.request', function() { + $httpBackend.when('GET').then(200); + scope.$on('$http.request', callback); + var xhrFuture = $http({method: 'GET', url: '/whatever'}); + + expect(callback).toHaveBeenCalledOnce(); + expect(callback.mostRecentCall.args[1]).toBe(xhrFuture); + }); + + describe('transform', function() { describe('request', function() { |
