Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3079a6f

Browse files
etiennebarriejeffbcross
authored andcommittedAug 1, 2013
fix(ngMock): keep withCredentials on passThrough
When using passThrough() and specifying withCredentials on the $http call, the option is now passed to the underlying $httpBackend.
1 parent 3c0c716 commit 3079a6f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/ngMock/angular-mocks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
10451045
}
10461046

10471047
// TODO(vojta): change params to: method, url, data, headers, callback
1048-
function $httpBackend(method, url, data, callback, headers, timeout) {
1048+
function $httpBackend(method, url, data, callback, headers, timeout, withCredentials) {
10491049
var xhr = new MockXhr(),
10501050
expectation = expectations[0],
10511051
wasExpected = false;
@@ -1103,7 +1103,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
11031103
// if $browser specified, we do auto flush all requests
11041104
($browser ? $browser.defer : responsesPush)(wrapResponse(definition));
11051105
} else if (definition.passThrough) {
1106-
$delegate(method, url, data, callback, headers, timeout);
1106+
$delegate(method, url, data, callback, headers, timeout, withCredentials);
11071107
} else throw Error('No response defined !');
11081108
return;
11091109
}

‎test/ngMock/angular-mocksSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1088,10 +1088,10 @@ describe('ngMockE2E', function() {
10881088
describe('passThrough()', function() {
10891089
it('should delegate requests to the real backend when passThrough is invoked', function() {
10901090
hb.when('GET', /\/passThrough\/.*/).passThrough();
1091-
hb('GET', '/passThrough/23', null, callback);
1091+
hb('GET', '/passThrough/23', null, callback, {}, null, true);
10921092

10931093
expect(realHttpBackend).toHaveBeenCalledOnceWith(
1094-
'GET', '/passThrough/23', null, callback, undefined, undefined);
1094+
'GET', '/passThrough/23', null, callback, {}, null, true);
10951095
});
10961096
});
10971097

0 commit comments

Comments
 (0)