Skip to content

Commit 78166dd

Browse files
authored
Merge pull request #854 from shital-orchestral/axios-uri-version-change
Axios and urijs package version updated
2 parents f11e885 + 1ea4161 commit 78166dd

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

apps/st2-workflows/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"react-redux": "^6.0.1",
7272
"react-router-dom": "^5.0.0",
7373
"redux": "^4.0.1",
74-
"urijs": "^1.19.1"
74+
"urijs": "^1.19.4 "
7575
},
7676
"devDependencies": {
7777
"@babel/core": "7.4.3",

modules/st2-api/api.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export class API {
175175

176176
const headers = {
177177
'content-type': 'application/json',
178+
179+
178180
};
179181

180182
if (this.token && this.token.token) {
@@ -186,20 +188,27 @@ export class API {
186188
url: this.route(opts),
187189
params: query,
188190
headers,
189-
transformResponse: [],
191+
transformResponse: [function transformResponse(data, headers) {
192+
if (typeof data === 'string' && headers["content-type"] === "application/json") {
193+
try {
194+
data = JSON.parse(data);
195+
} catch (e) { /* Ignore */ }
196+
}
197+
return data;
198+
}
199+
],
190200
data,
191201
withCredentials: true,
192202
paramsSerializer: params => {
193203
params = _.mapValues(params, param => {
194204
if (_.isArray(param)) {
195205
return param.join(',');
196206
}
197-
198207
return param;
199208
});
200-
201209
return buildURL('', params).substr(1);
202210
},
211+
// responseType: 'json',
203212
};
204213

205214
if (this.rejectUnauthorized === false) {
@@ -210,7 +219,6 @@ export class API {
210219
}
211220

212221
const response = await axios(config);
213-
214222
const contentType = (response.headers || {})['content-type'] || [];
215223
const requestId = (response.headers || {})['X-Request-ID'] || null;
216224

modules/st2-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"lodash": "4.17.19",
3131
"react": "16.8.6",
3232
"react-dom": "16.8.6",
33-
"axios": "^0.18.0",
33+
"axios": "^0.21.1",
3434
"moxios": "^0.4.0"
3535
},
3636
"devDependencies": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"react-redux": "7.0.2",
8686
"redux": "^4.0.1",
8787
"set-value": "^2.0.1",
88-
"urijs": "1.19.4",
88+
"urijs": "^1.19.4",
8989
"websocket-extensions": "^0.1.4"
9090
},
9191
"devDependencies": {

0 commit comments

Comments
 (0)