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

Mock httpBackend does not support blobs for passThrough. #5415

Closed
michaelkrog opened this issue Dec 15, 2013 · 5 comments
Closed

Mock httpBackend does not support blobs for passThrough. #5415

michaelkrog opened this issue Dec 15, 2013 · 5 comments

Comments

@michaelkrog
Copy link

I have tried to use the Mock httpbackend with passThrough for some audio files retrieved from a server.

It works fine when not using the Mock httpBackend, but when I switch to the Mock backend the data returned are not blobs, but strings. The data is there is seems because chrome freezes when debugging and watching the variable - like the data contained in the string is just to big for it to handle.

The way I use $http is like this:

$http({method: 'GET', url: url, responseType: 'blob'}).success(...);
@ghost ghost assigned IgorMinar Dec 20, 2013
@IgorMinar
Copy link
Contributor

Could you post a plunker with an example of the setup you use.

The mock backend wasn't initially implemented with blobs in mind but it should be fixable. Having a good way to reproduce your use case would help a lot.

@michaelkrog
Copy link
Author

Hi.

Created a plunker her: http://plnkr.co/edit/w6PzCj?p=preview
Loads a file from https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js as blob, but a string is returned.

@biohazardpb4
Copy link

Here's a Plunk of the fix :)
http://plnkr.co/edit/eT9bIESihUY85LU32vZv?p=preview

@schmod
Copy link
Contributor

schmod commented Feb 19, 2014

Confirmed both the bug and @biohazardpb4's fix.

@btford btford removed the gh: issue label Aug 20, 2014
@brphelps
Copy link

brphelps commented Apr 4, 2015

Is this fix being deferred for some reason?

prateek14 added a commit to prateek14/angular.js that referenced this issue Apr 7, 2015
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 angular#5415
prateek14 added a commit to prateek14/angular.js that referenced this issue Apr 9, 2015
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 angular#5415
prateek14 added a commit to prateek14/angular.js that referenced this issue Apr 9, 2015
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 angular#5415
gkalpak pushed a commit that referenced this issue Feb 16, 2016
…rough`

The `ngMockE2E` `$httpBackend` has a mechanism to allow requests to pass through, if one wants to
send a real HTTP request instead of mocking. The specified `responseType` of the request was never
passed through to the "real" `$httpBackend` (of the `ng` module), resulting in it being effectively
ignored.

Fixes #5415

Closes #5783
gkalpak pushed a commit that referenced this issue Feb 16, 2016
…rough`

The `ngMockE2E` `$httpBackend` has a mechanism to allow requests to pass through, if one wants to
send a real HTTP request instead of mocking. The specified `responseType` of the request was never
passed through to the "real" `$httpBackend` (of the `ng` module), resulting in it being effectively
ignored.

Fixes #5415

Closes #5783
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.