MCPcopy Index your code
hub / github.com/reactnativecn/react-native-update / enhancedFetch

Function enhancedFetch

src/utils.ts:138–152  ·  view source on GitHub ↗
(
  url: string,
  params: Parameters<typeof fetch>[1],
  isRetry = false,
)

Source from the content-addressed store, hash-verified

136};
137
138export const enhancedFetch = async (
139 url: string,
140 params: Parameters<typeof fetch>[1],
141 isRetry = false,
142): Promise<Response> => {
143 return fetch(url, params)
144 .catch(e => {
145 log('fetch error', url, e);
146 if (isRetry) {
147 throw e;
148 }
149 log('trying fallback to http');
150 return enhancedFetch(url.replace('https', 'http'), params, true);
151 });
152};

Callers 1

fetchWithTimeoutFunction · 0.85

Calls 2

fetchFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected