[whatwg/fetch] Reading `FormData` from `Request()`; setting correct `MIME` type (#480)

Where `FormData` instance is passed to `Request()`, then read using `.arrayBuffer()` if `FileReader` and `Blob` are used to read `ArrayBuffer`, where `.type` is explicitly set, an uploaded image, for example, is not rendered when passed to `.readAsDataURL()`. Else, resulting `data URI` will not have `MIME` type set.

If `.blob()` is used, returned `Blob` `.type` is set to `"multipart/form-data; boundary=----webkitformboundaryXXXXXXXXXXXXXXXX""`.

Is this expected behaviour? Or should user expect `.blob()` `.type` to be set to `Blob` or `File` instance passed to `FormData`?

References:

- [Creating multipart/form-data request in own library in javascript](http://stackoverflow.com/questions/42033251/creating-multipart-form-data-request-in-own-library-in-javascript)

- [Request.arrayBuffer returns empty ArrayBuffer when using FormData with files](https://bugs.chromium.org/p/chromium/issues/detail?id=688100)

- https://plnkr.co/edit/9GmmLXNTZLgBWQzYgzmM?p=preview

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/480

Received on Friday, 3 February 2017 22:43:09 UTC