Skip to content

Commit

Permalink
Merge pull request #357 from yosiat/isolate-axios
Browse files Browse the repository at this point in the history
ApiClient: don't override global axios timeout
  • Loading branch information
webkod3r authored Jun 13, 2024
2 parents dfbc900 + f75a10a commit 8071978
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{>licenseInfo}}
var axios = require('axios');

axios.defaults.timeout = 300000; // 300s
var axiosInstance = axios.create({
timeout: 300000 // 300s
});


{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#-first}}var {{baseName}} = require('./api/{{classname}}');
{{/-first}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
Expand Down Expand Up @@ -47,7 +50,7 @@ exports.prototype.post = function post(path, body = {}) {
url = url + '.' + defaultOutputFormat;
}

return axios
return axiosInstance
.post(url, body)
.then(function (response) {
return response.data;
Expand All @@ -66,7 +69,7 @@ exports.prototype.setDefaultOutputFormat = function (outputFormat) {
};

exports.prototype.setDefaultTimeoutMs = function (timeoutMs) {
axios.defaults.timeout = timeoutMs;
axiosInstance.defaults.timeout = timeoutMs;
}

// The default API client implementation.
Expand Down

0 comments on commit 8071978

Please sign in to comment.