mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
bccc92dfdd
Summary: The original reason for vendoring the fetch polyfill was to remove the default blob response type but this was reverted. Here's a little history around the fetch polyfill and the blob issue: - Original commit introducing the vendored polyfill: #19333, the goal was to fix a memory leak because our blob implementation doesn't release resources automatically. Not an ideal fix but since the issue was pretty severe and the infra for a proper fix was not in place. - This introduced an issue when downloading images using `fetch` which was fixed by #22063 which re-added the default blob content type. However that re-introduced the original fetch memory leak. - We have better infra now with jsi and I was able to get blob deallocation working, see #24405 Currently the vendored fetch polyfill is useless since it was changed back to the original version. We can just use the npm version again. I also updated to 3.0 which brings better spec compliance and support for cancellation via `AbortController`, https://github.com/github/fetch/releases/tag/v3.0.0. ## Changelog [General] [Changed] - Remove vendored fetch polyfill, update to whatwg-fetch@3.0 Pull Request resolved: https://github.com/facebook/react-native/pull/24418 Differential Revision: D14932683 Pulled By: cpojer fbshipit-source-id: 915e3d25978e8b9d7507ed807e7fba45aa88385a
21 lines
426 B
JavaScript
21 lines
426 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
/* globals Headers, Request, Response */
|
|
|
|
'use strict';
|
|
|
|
const whatwg = require('whatwg-fetch');
|
|
|
|
if (whatwg && whatwg.fetch) {
|
|
module.exports = whatwg;
|
|
} else {
|
|
module.exports = {fetch, Headers, Request, Response};
|
|
}
|