No polyfill for Blob (Android)
genne opened this issue · 3 comments
I'm submitting a bug report
- Library Version:
rc.1.0.0
Please tell us about your environment:
- Browser:
Android Web Browser
Current behavior:
On Android you get TypeError: Illegal constructor
when trying to use json
from aurelia-fetch-client. It uses Blob
which isn't supported on these devices.
(I don't own an Android my self so cannot reproduce, but we get a lot of error reports from different users.)
Expected/desired behavior:
Callstack:
TypeError: Illegal constructor
at Object.b [as json]
...
Since new Blob
won't work on these devices there should probably be a polyfill for it.
Related issue: MobileChromeApps/mobile-chrome-apps#18
See http://aurelia.io/hub.html#/doc/article/aurelia/fetch-client/latest/http-services/2, section Bring Your Own Polyfill.
I'm using a polyfill for fetch
, but this is related to the json
helper method being part of aurelia-fetch-client: https://github.com/aurelia/fetch-client/blob/master/src/util.js
According to the link you posted:
The Fetch API has no convenient way of sending JSON in the body of a request. Objects must be manually serialized to JSON, and the Content-Type header set appropriately. aurelia-fetch-client includes a helper called json for this.
This helper uses new Blob
which needs a polyfill in order to work on Android.
@genne Can you send a PR to the docs to ammend them with info about needing to bring a Blob polyfill? I don't think we're going to add that to the base polyfills since it's conditional on this one scenario.