constructor(timeout = 10000, retries = 5, proxyConfig, debug = false) { axiosRetry(Axios, { retries: retries, }); this.timeout = timeout; this.proxyConfig = proxyConfig; if (debug) this.enableDebug(); }
function B2(options) { this.accountId = options.accountId; this.applicationKeyId = options.applicationKeyId; this.applicationKey = options.applicationKey; this.authorizationToken = null; this.apiUrl = null; this.downloadUrl = null; /* allows an optional axios config object that overrides the default axios config creates new axios instance so that axios-retry isn't injected into the user's code if they also use axios */ const axiosClient = axios.create(Object.assign({ /* no defaults for now */ }, options.axios)); /* allows an optional retry config object that overrides the default retry behaviour please see https://github.com/softonic/axios-retry for additional options retries 3 times by default retries only on network errors and 5xx errors on indempotent requests (GET, HEAD, OPTIONS, PUT, or DELETE) by default */ axiosRetry(axiosClient, Object.assign({ retries: 3 }, options.retry)); request.setup(axiosClient); }