Skip to content
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

Passing ArrayBuffer as content produces unintuitive behavior #161

Closed
stickfigure opened this issue Feb 21, 2017 · 2 comments
Closed

Passing ArrayBuffer as content produces unintuitive behavior #161

stickfigure opened this issue Feb 21, 2017 · 2 comments

Comments

@stickfigure
Copy link

I'm submitting a bug report

  • Library Version:
    1.0.4

Current behavior:
Passing an ArrayBuffer to withContent() causes the contentTransformer to convert the body to an empty JSON object ({}).

Expected/desired behavior:
I expected passing an ArrayBuffer to withContent() would send the binary data as a payload. If for some reason ArrayBuffer is not allowed, I expected some sort of error message.

Silently converting it to JSON is super confusing and it took me a while to notice that the payload was not the binary I expected, then to figure out why :-(

The guilty code:
https://github.com/aurelia/http-client/blob/master/src/xhr-transformers.js#L90

@EisenbergEffect
Copy link
Contributor

Definitely appears to be a bug. The ArrayBufferView should probably be changed to ArrayBuffer. Any interest in submitting a PR?

maurice-camp added a commit to maurice-camp/http-client that referenced this issue Mar 24, 2017
@maurice-camp
Copy link
Contributor

Also experiencing this issue. Created a pull request to fix this for ArrayBuffers.

This does not fix the issue however when sending ArrayBufferViews such as 'Uint8Array'.

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

No branches or pull requests

3 participants