react-native-update 10.30.1 → 10.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils.ts +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.30.1",
3
+ "version": "10.30.2",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/utils.ts CHANGED
@@ -108,7 +108,8 @@ export const assertWeb = () => {
108
108
  export const enhancedFetch = async (
109
109
  url: string,
110
110
  params: Parameters<typeof fetch>[1],
111
- ) => {
111
+ isRetry = false,
112
+ ): Promise<Response> => {
112
113
  return fetch(url, params)
113
114
  .then(r => {
114
115
  if (r.ok) {
@@ -118,7 +119,10 @@ export const enhancedFetch = async (
118
119
  })
119
120
  .catch(e => {
120
121
  log('fetch error', url, e);
122
+ if (isRetry) {
123
+ throw e;
124
+ }
121
125
  log('trying fallback to http');
122
- return fetch(url.replace('https', 'http'), params);
126
+ return enhancedFetch(url.replace('https', 'http'), params, true);
123
127
  });
124
128
  };