diff --git a/lib/rest/axios.js b/lib/rest/axios.js index 1e27bea..0b81ddb 100644 --- a/lib/rest/axios.js +++ b/lib/rest/axios.js @@ -17,11 +17,11 @@ export function Axios(config) { const max_time = options.retryTime; let counter = 0; axios.interceptors.response.use(null, (error) => { - const config = error.config + const config = error.config; if (counter < max_time && error.response.status >= 500) { - counter++ + counter++; return new Promise((resolve) => { - resolve(axios(config)) + resolve(axios(config)); }) } return Promise.reject(error) @@ -30,17 +30,17 @@ export function Axios(config) { return (method, action, params) => { if (typeof (params) != 'undefined' && typeof (params.file) != 'undefined') { - var files = [] + let files = []; if (Array.isArray(params.file)) { for (let index = 0; index < params.file.length; index++) { - files[index] = require('fs').createReadStream(params.file[index]) + files[index] = require('fs').createReadStream(params.file[index]); } } else { files[0] = require('fs').createReadStream(params.file); } params.file = files; } - var options = { + let options = { url: config.url + '/' + action, method: method, data: params || '', @@ -85,7 +85,7 @@ export function Axios(config) { return new Promise((resolve, reject) => { if (isVoiceReq) { - retryWrapper(axios, {retryTime: 2}) + retryWrapper(axios, {retryTime: 2}); let retryAttempt; for (retryAttempt = 0; retryAttempt < 3; retryAttempt++) { options.url = apiVoiceUris[retryAttempt] + config.authId + '/' + action;