New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$http service should accept xhr2's responseType property #1013

Closed
ebidel opened this Issue Jun 4, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@ebidel

ebidel commented Jun 4, 2012

http://www.html5rocks.com/en/tutorials/file/xhr2/

Requesting the resource as a "blob" or "arraybuffer" is something new to xhr and is quite useful for working with binary data

@vojtajina

This comment has been minimized.

Show comment
Hide comment
@vojtajina

vojtajina Aug 4, 2012

Contributor

In case of responseType is not text (arraybuffer, blob, document), the data passed to callback should be xhr.response, instead of xhr.responseText.

Contributor

vojtajina commented Aug 4, 2012

In case of responseType is not text (arraybuffer, blob, document), the data passed to callback should be xhr.response, instead of xhr.responseText.

@ghost ghost assigned vojtajina Aug 4, 2012

@ebidel

This comment has been minimized.

Show comment
Hide comment
@ebidel

ebidel Aug 4, 2012

IIRC, Chrome sets xhr.response also in the responseType='', responseType='text' cases.
But that could very well be in implementation divergence from the spec.

ebidel commented Aug 4, 2012

IIRC, Chrome sets xhr.response also in the responseType='', responseType='text' cases.
But that could very well be in implementation divergence from the spec.

vojtajina added a commit to vojtajina/angular.js that referenced this issue Aug 4, 2012

@vojtajina vojtajina closed this in e0a54f6 Aug 10, 2012

@felixfbecker

This comment has been minimized.

Show comment
Hide comment
@felixfbecker

felixfbecker Aug 21, 2015

I'm trying to get binary data (a simple jpeg image) with responseType: 'blob' (also tried 'arraybuffer'), but the data property of the response object is always a string instead of a Blob object. Am I doing something wrong? This issue is closed, so it should work, right?

felixfbecker commented Aug 21, 2015

I'm trying to get binary data (a simple jpeg image) with responseType: 'blob' (also tried 'arraybuffer'), but the data property of the response object is always a string instead of a Blob object. Am I doing something wrong? This issue is closed, so it should work, right?

@felixfbecker

This comment has been minimized.

Show comment
Hide comment
@felixfbecker

felixfbecker Aug 21, 2015

Ok I found out it didn't work because I was using ngMockE2E. However, I specified to passThrough() the request - it seems like $httpBackend swallows the responseType parameter.
See #11524

felixfbecker commented Aug 21, 2015

Ok I found out it didn't work because I was using ngMockE2E. However, I specified to passThrough() the request - it seems like $httpBackend swallows the responseType parameter.
See #11524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment