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

Commit fd4e7b7

Browse files
committed
fix(ngMock): Add responseType function parameter in mock httpbackend for
passthrough The ngMock $httpBackend allows http request routes that have not been defined for mocking to be passed through to the real http backend service. The responseType parameter was missing in the ngMock httpbackend parameter list. closes #5415
1 parent 73ab107 commit fd4e7b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ngMock/angular-mocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
11291129
}
11301130

11311131
// TODO(vojta): change params to: method, url, data, headers, callback
1132-
function $httpBackend(method, url, data, callback, headers, timeout, withCredentials) {
1132+
function $httpBackend(method, url, data, callback, headers, timeout, withCredentials, responseType) {
11331133
var xhr = new MockXhr(),
11341134
expectation = expectations[0],
11351135
wasExpected = false;

test/ngMock/angular-mocksSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1796,19 +1796,19 @@ describe('ngMockE2E', function() {
17961796
describe('passThrough()', function() {
17971797
it('should delegate requests to the real backend when passThrough is invoked', function() {
17981798
hb.when('GET', /\/passThrough\/.*/).passThrough();
1799-
hb('GET', '/passThrough/23', null, callback, {}, null, true);
1799+
hb('GET', '/passThrough/23', null, callback, {}, null, true, 'arraybuffer');
18001800

18011801
expect(realHttpBackend).toHaveBeenCalledOnceWith(
1802-
'GET', '/passThrough/23', null, callback, {}, null, true);
1802+
'GET', '/passThrough/23', null, callback, {}, null, true, 'arraybuffer');
18031803
});
18041804

18051805
it('should be able to override a respond definition with passThrough', function() {
18061806
var definition = hb.when('GET', /\/passThrough\/.*/).respond('override me');
18071807
definition.passThrough();
1808-
hb('GET', '/passThrough/23', null, callback, {}, null, true);
1808+
hb('GET', '/passThrough/23', null, callback, {}, null, true, 'arraybuffer');
18091809

18101810
expect(realHttpBackend).toHaveBeenCalledOnceWith(
1811-
'GET', '/passThrough/23', null, callback, {}, null, true);
1811+
'GET', '/passThrough/23', null, callback, {}, null, true, 'arraybuffer');
18121812
});
18131813

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

0 commit comments

Comments
 (0)