Skip to content

Commit 7fd3062

Browse files
Add request retry and fix url encoding
1 parent 9ca78e3 commit 7fd3062

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes will be documented in this file.
44

5+
## [1.0.10] - 2023-02-03
6+
7+
* Fix url encoding for app name.
8+
* Added request retry for failed requests.
9+
510
## [1.0.9] - 2023-01-16
611

712
* Fix localization backward compatibility.

package-lock.json

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "app-upgrade-react-native-sdk",
3-
"version": "1.0.9",
4-
"description": "app upgrade react-native sdk",
3+
"version": "1.0.10",
4+
"description": "Official App Upgrade react-native sdk",
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
@@ -17,7 +17,8 @@
1717
},
1818
"license": "MIT",
1919
"dependencies": {
20-
"axios": "^0.27.2"
20+
"axios": "^0.27.2",
21+
"axios-retry": "^3.4.0"
2122
},
2223
"peerDependencies": {
2324
"react": ">=16.9.0",

src/api.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
import axios from "axios";
2+
import axiosRetry from 'axios-retry';
23

34
async function checkVersionWithAppUpgrade(appInfo, xApiKey) {
45
try {
56
const appUpgradeBaseUrl = "https://appupgrade.dev";
67
const { appName, appVersion, platform, environment, appLanguage } = appInfo;
78

9+
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay, retryCondition: () => true });
10+
811
const response = await axios.get(
9-
`${appUpgradeBaseUrl}/api/v1/versions/check?app_name=${appName}&app_version=${appVersion}&platform=${platform}&environment=${environment}&app_language=${appLanguage}`,
12+
`${appUpgradeBaseUrl}/api/v1/versions/check`,
1013
{
1114
headers: {
1215
"x-api-key": xApiKey,
1316
"sdk": "react-native" //Telemetry purposes
1417
},
18+
params: {
19+
app_name: appName,
20+
app_version: appVersion,
21+
platform: platform,
22+
environment: environment,
23+
app_language: appLanguage,
24+
},
1525
validateStatus: function (status) {
1626
return status >= 200 && status < 500; // default
1727
},

0 commit comments

Comments
 (0)