From 209b67df6a49fe1646ce63c5e7d11ed26e8abbc1 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 29 Jul 2012 17:52:19 -0700 Subject: feat($http): Allow setting withCredentials on defaults Closes #1095. --- test/ng/httpSpec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js index f7df3d4b..45d31eef 100644 --- a/test/ng/httpSpec.js +++ b/test/ng/httpSpec.js @@ -981,4 +981,27 @@ describe('$http', function() { $httpBackend.verifyNoOutstandingExpectation = noop; }); + + + it('should use withCredentials from default', function() { + var $httpBackend = jasmine.createSpy('$httpBackend'); + + $httpBackend.andCallFake(function(m, u, d, c, h, timeout, withCredentials, responseType) { + expect(withCredentials).toBe(true); + }); + + module(function($provide) { + $provide.value('$httpBackend', $httpBackend); + }); + + inject(function($http) { + $http.defaults.withCredentials = true; + $http({ + method: 'GET', url: 'some.html', timeout: 12345, responseType: 'json' + }); + expect($httpBackend).toHaveBeenCalledOnce(); + }); + + $httpBackend.verifyNoOutstandingExpectation = noop; + }); }); -- cgit v1.2.3