From c94f72de0fc0598df9d3e6a7c10dcbbc37004fe0 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 19 Oct 2022 18:28:51 -0400 Subject: [PATCH] Add extra fetch properties if there were any --- packages/react/src/ReactFetch.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react/src/ReactFetch.js b/packages/react/src/ReactFetch.js index a67c2c09a11e1..7c39cefdf3f92 100644 --- a/packages/react/src/ReactFetch.js +++ b/packages/react/src/ReactFetch.js @@ -118,6 +118,9 @@ if (enableCache && enableFetchInstrumentation) { // of the body so that it can be read multiple times. return match.then(response => response.clone()); }; + // We don't expect to see any extra properties on fetch but if there are any, + // copy them over. Useful for extended fetch environments or mocks. + Object.assign(fetch, originalFetch); } catch (error) { // Log even in production just to make sure this is seen if only prod is frozen. // eslint-disable-next-line react-internal/no-production-logging