From fd632f53c76b8791aee4d85ca50c9aca17833a2f Mon Sep 17 00:00:00 2001 From: Marius Reimer Date: Mon, 10 Dec 2018 16:56:56 -0800 Subject: [PATCH] set blob as default XMLHttpRequest header response type if supported (#22063) Summary: This is a problem that is discussed in issue #21092 Related issues: #21851 #19717 Found the code to eventually fix this issue [here](https://github.com/github/fetch/blob/899b155746630c32d83ee29a38642da16b314ecb/fetch.js#L486) - [x] Fetching an image locally and check if the blob is there, as well as its size > 0. ___ Help reviewers and the release process by writing your own release notes. See below for an example. [GENERAL] [ENHANCEMENT] [whatwg-fetch] - set blob as default XMLHttpRequest header response type if supported Pull Request resolved: https://github.com/facebook/react-native/pull/22063 Differential Revision: D13408797 Pulled By: cpojer fbshipit-source-id: 9822d5a7e24bacd72838f3fc9a61b1a97b44484b --- Libraries/vendor/core/whatwg-fetch.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/vendor/core/whatwg-fetch.js b/Libraries/vendor/core/whatwg-fetch.js index febc54dac8dd84..19591001401409 100644 --- a/Libraries/vendor/core/whatwg-fetch.js +++ b/Libraries/vendor/core/whatwg-fetch.js @@ -516,6 +516,10 @@ xhr.withCredentials = false; } + if ('responseType' in xhr && support.blob) { + xhr.responseType = 'blob' + } + request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value); });