Skip to content

Commit

Permalink
Merge pull request #854 from shital-orchestral/axios-uri-version-change
Browse files Browse the repository at this point in the history
Axios and urijs package version updated
  • Loading branch information
m4dcoder committed Feb 11, 2021
2 parents f11e885 + 1ea4161 commit 78166dd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/st2-workflows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"react-redux": "^6.0.1",
"react-router-dom": "^5.0.0",
"redux": "^4.0.1",
"urijs": "^1.19.1"
"urijs": "^1.19.4 "
},
"devDependencies": {
"@babel/core": "7.4.3",
Expand Down
16 changes: 12 additions & 4 deletions modules/st2-api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ export class API {

const headers = {
'content-type': 'application/json',


};

if (this.token && this.token.token) {
Expand All @@ -186,20 +188,27 @@ export class API {
url: this.route(opts),
params: query,
headers,
transformResponse: [],
transformResponse: [function transformResponse(data, headers) {
if (typeof data === 'string' && headers["content-type"] === "application/json") {
try {
data = JSON.parse(data);
} catch (e) { /* Ignore */ }
}
return data;
}
],
data,
withCredentials: true,
paramsSerializer: params => {
params = _.mapValues(params, param => {
if (_.isArray(param)) {
return param.join(',');
}

return param;
});

return buildURL('', params).substr(1);
},
// responseType: 'json',
};

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

const response = await axios(config);

const contentType = (response.headers || {})['content-type'] || [];
const requestId = (response.headers || {})['X-Request-ID'] || null;

Expand Down
2 changes: 1 addition & 1 deletion modules/st2-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lodash": "4.17.19",
"react": "16.8.6",
"react-dom": "16.8.6",
"axios": "^0.18.0",
"axios": "^0.21.1",
"moxios": "^0.4.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"react-redux": "7.0.2",
"redux": "^4.0.1",
"set-value": "^2.0.1",
"urijs": "1.19.4",
"urijs": "^1.19.4",
"websocket-extensions": "^0.1.4"
},
"devDependencies": {
Expand Down

0 comments on commit 78166dd

Please sign in to comment.