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

fix passing eventHandlers when passThrough #14471

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
// if $browser specified, we do auto flush all requests
($browser ? $browser.defer : responsesPush)(wrapResponse(definition));
} else if (definition.passThrough) {
$delegate(method, url, data, callback, headers, timeout, withCredentials, responseType);
$delegate(method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers);
} else throw new Error('No response defined !');
return;
}
Expand Down
4 changes: 2 additions & 2 deletions test/ngMock/angular-mocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ describe('ngMockE2E', function() {
hb('GET', '/passThrough/23', null, callback, {}, null, true, 'blob');

expect(realHttpBackend).toHaveBeenCalledOnceWith(
'GET', '/passThrough/23', null, callback, {}, null, true, 'blob');
'GET', '/passThrough/23', null, callback, {}, null, true, 'blob', undefined, undefined);
});

it('should be able to override a respond definition with passThrough', function() {
Expand All @@ -2146,7 +2146,7 @@ describe('ngMockE2E', function() {
hb('GET', '/passThrough/23', null, callback, {}, null, true);

expect(realHttpBackend).toHaveBeenCalledOnceWith(
'GET', '/passThrough/23', null, callback, {}, null, true, undefined);
'GET', '/passThrough/23', null, callback, {}, null, true, undefined, undefined, undefined);
});

it('should be able to override a respond definition with passThrough', inject(function($browser) {
Expand Down