How to use the create function from axios
Find comprehensive JavaScript axios.create code examples handpicked from public code repositorys.
81 82 83 84 85 86 87 88 89 90
} actions.debug('Instance Configuration: ' + JSON.stringify(instanceConfig)) /** @type {axios.AxiosInstance} */ const instance = axios.create(instanceConfig); actions.debug('Request Data: ' + JSON.stringify(requestData)) const execRequest = async () => {
60
185
4
+ 5 other calls in file
43 44 45 46 47 48 49 50 51 52 53
const { Readable } = require("stream") const heicConvert = require("heic-convert") const { Semaphore } = require("await-semaphore") const progress = require("progress-stream") const axiosClient = axios.create({ timeout: 3600000, maxContentLength: (((1024 * 1024) * 1024) * 1024), maxBodyLength: (((1024 * 1024) * 1024) * 1024), httpsAgent: new https.Agent({
24
118
8
+ 3 other calls in file
28 29 30 31 32 33 34 35 36 37
assert(signer instanceof Signer); this._signer = signer; this._client = axios.create( Object.assign(this._clientOptions, { headers: { 'X-Key-Id': keyId, },
6
32
1
+ 9 other calls in file
9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276
$("#validation_error_accordion").html(accordion_elements); // $("#validation_error_accordion").accordion(); }; $("#validate_dataset_bttn").on("click", async () => { const axiosInstance = axios.create({ baseURL: "http://127.0.0.1:5000/", timeout: 0, });
9
22
9
+ 7 other calls in file
16 17 18 19 20 21 22 23 24 25
DIMS_API_POLL_INTERVAL } = require('./config') module.exports = exports = {} const client = axios.create({ baseURL: DIMS_API_URL }) let token = '' let walletInfo // let socket let checkIsRunning = false
2
2
5
157 158 159 160 161 162 163 164 165 166
} //================================================================================================= // Initialize Axios Client (this client will be used to communicate with the device) === //================================================================================================= this.syrApiClient = axios.create({ baseURL: `http://${this.config.device_ip}:${this.config.device_port}/safe-tec/`, timeout: timeout_axios_request * 1000, responseType: 'json', responseEncoding: 'utf8',
1
3
2
+ 3 other calls in file
GitHub: dynatrace-oss/unguard
104 105 106 107 108 109 110 111 112 113 114 115
app.use(cookieParser()); // for parsing application/xwww-form-urlencoded app.use(bodyParser.urlencoded({ extended: true })); function createAxiosInstance(req, baseURL, logger, headers) { const axiosInstace = axios.create({baseURL, headers}); axiosInstace.interceptors.response.use(undefined, function (error) { logger.log({level: 'error', message: error, errorType: 'http'}); return Promise.reject(error)
0
11
6
+ 3 other calls in file
GitHub: Markkop/nest
168 169 170 171 172 173 174 175 176 177
/** * Service created lifecycle event handler. */ created() { this.axios = axios.create({ baseURL: this.settings.axios.baseURL, timeout: this.settings.axios.timeout, headers: this.settings.axios.headers })
0
3
1
GitHub: myTapp/movidesk-api
42 43 44 45 46 47 48 49 50
if ( !this.options.token ) { throw new Error('Token must be passed!'); } this.movapi = axios.create({ baseURL: this.options.base_url || "https://api.movidesk.com/public/v1", timeout: this.options.timeout || 3000 });
0
2
3
258 259 260 261 262 263 264 265 266 267
### Creating an instance You can create a new instance of axios with a custom config. ##### axios.create([config]) ```js const instance = axios.create({ baseURL: 'https://some-domain.com/api/',
0
1
0
+ 3 other calls in file
16 17 18 19 20 21 22 23 24 25
// GitHub API client (both REST and GraphQL) const octokit = new Octokit({ auth: process.env.GITHUB_API_TOKEN }); // ZenHub API client const zhApi = axios.create({ baseURL: 'https://api.zenhub.com/', headers: { 'X-Authentication-Token': process.env.ZENHUB_API_TOKEN, },
59
0
1
GitHub: DrozmotiX/ioBroker.tado
19 20 21 22 23 24 25 26 27 28
const state_attr = require(`${__dirname}/lib/state_attr.js`); // Load attribute library const isOnline = require('@esm2cjs/is-online').default; const https = require('https'); const axios = require('axios'); // @ts-ignore let axiosInstance = axios.create({}); const oneHour = 60 * 60 * 1000; let polling; // Polling timer let pooltimer = [];
11
24
12
GitHub: haizlin-idea/weixin
4 5 6 7 8 9 10 11 12 13
const BASE_URL2 = 'https://puzzle.zaih.com' const BASE_URL3 = 'https://apis-puzzle-new.zaih.com' module.exports = class Https { constructor ({access_token, account_id}) { this.request = axios.create({ headers: { ...headers, uid: account_id, // eslint-disable-next-line camelcase
394
3
2
GitHub: codeceptjs/CodeceptJS
36 37 38 39 40 41 42 43 44 45
* ## Methods */ class GraphQL extends Helper { constructor(config) { super(config); this.axios = axios.create(); this.headers = {}; this.options = { timeout: 10000, defaultHeaders: {},
706
0
106
GitHub: jens-maus/node-unifi
2974 2975 2976 2977 2978 2979 2980 2981 2982
if (this._isInit === true) { return 2; } const jar = this._cookieJar; this._instance = axios.create({ httpAgent: new HttpCookieAgent({cookies: {jar}}), httpsAgent: new HttpsCookieAgent({cookies: {jar}, rejectUnauthorized: this.opts.sslverify, requestCert: true}) });
43
108
9
+ 2 other calls in file
387 388 389 390 391 392 393 394 395 396
// axiosConfig.baseURL = 'https://httpstat.us'; // axiosConfig.url = '/429'; // axiosConfig.method = 'get'; const myAxiosInstance = axios.create(axiosConfig); myAxiosInstance.defaults.raxConfig = { instance: myAxiosInstance, };
2
7
2
+ 3 other calls in file
242 243 244 245 246 247 248 249 250 251
//===================================================================================================================== // Initialize Axios Client for SafeFloor Units (this client will be used to communicate with the SafeFloor units) === //===================================================================================================================== if (this.config.safefloor_1_ip != '0.0.0.0' && this.config.safefloor_1_ip != '') { this.log.info('SafeFloor Connect Unit 1 IP-Address: ' + String(this.config.safefloor_1_ip) + ':' + String(this.config.device_port)); this.syrSaveFloor1APIClient = axios.create({ baseURL: `http://${this.config.safefloor_1_ip}:${this.config.device_port}/floorsensor/`, timeout: FloorSensoLoopTimeout * 1000, responseType: 'json', responseEncoding: 'utf8',
1
3
2
+ 4 other calls in file
26 27 28 29 30 31 32 33 34 35
this.poll_check_time = 0; this.session = {}; this.mqttC = {}; this.mqtt_response_check = {}; this.cookieJar = new tough.CookieJar(); this.requestClient = axios.create({ withCredentials: true, httpsAgent: new HttpsCookieAgent({ cookies: { jar: this.cookieJar,
1
3
0
6 7 8 9 10 11 12 13 14 15 16
DELETE: "DELETE", }; class AnythinkClient { constructor() { this.client = axios.create({ baseURL: "http://localhost:3000", timeout: 2000, }); }
0
1
0
+ 2 other calls in file
GitHub: yaklang/yakit
5 6 7 8 9 10 11 12 13 14 15
ipcMain.on("sync-edit-baseUrl", (event, arg) => { HttpSetting.httpBaseURL = arg.baseUrl event.returnValue = arg }) const service = axios.create({ // baseURL: "http://onlinecs.vaiwan.cn/api/", baseURL: `${HttpSetting.httpBaseURL}/api/`, timeout: 30 * 1000, // 请求超时时间 maxBodyLength: Infinity, //设置适当的大小
722
0
338
+ 4 other calls in file