Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

axios-extra

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-extra - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+20
test/demo.js
const axios = require('../'); //默认最大并发 10, 重试 0;
axios.defaults.maxConcurrent = 1; //修改并发为1
// 创建一个 并发为2, 自动重试为3的 axios;
let axios1 = axios.create({
maxConcurrent: 2,
queueOptions: { retry:3 }
});
for(let i=0; i<10; i++){
axios.get('https://cnodejs.org/api/v1/topics').then((res)=>{
console.log( i , res.data.data.length);
if(i == 9){
clearInterval(si);
}
});
axios1.get('https://cnodejs.org/api/v1/topics').then((res)=>{
console.log( 'axios1', i , res.data.data.length);
});
}
var si = setInterval(console.log.bind(null,'...'),300);
+9
-2
const Queue = require('promise-queue-plus/create')(Promise);
const apis_arg2 = new Set(['request', 'get', 'delete', 'head', 'options']);
const apis_arg1 = new Set(['request']);
const apis_arg2 = new Set(['get', 'delete', 'head', 'options']);
const apis_arg3 = new Set(['post', 'put', 'patch']);

@@ -74,3 +75,9 @@ const DEF_MAX_CONCURRENT = 10;

let attr = Reflect.get(target, property, receiver);
let i = apis_arg2.has(property) ? 1 : apis_arg3.has(property) ? 2 : null;
let i = apis_arg1.has(property)
? 0
: apis_arg2.has(property)
? 1
: apis_arg3.has(property)
? 2
: null;
if (i) {

@@ -77,0 +84,0 @@ return function(...args) {

+1
-1
{
"name": "axios-extra",
"version": "0.0.3",
"version": "0.0.4",
"description": "Extend \"Axios\"; add concurrency limits, retry, etc.",

@@ -5,0 +5,0 @@ "main": "index.js",