adajuly / cute-http Goto Github PK
View Code? Open in Web Editor NEW一个基于axios封装的更易用的http库。
一个基于axios封装的更易用的http库。
function multi(items, extendedAxiosConfig) {
var conf = _makeConfig(extendedAxiosConfig);
var tasks = items.forEach(function (item) {
var task;
var type = item.type;
var url = item.url;
if (conf.failStrategy === cst.KEEP_ALL_BEEN_EXECUTED) {
if (type === 'get') task = _get(url, conf).catch(function (err) { return err; });
else if (type === 'post') task = _post(url, item.body, conf).catch(function (err) { return err; });
else if (type === 'jsonp') task = _jsonp(url, conf).catch(function (err) { return err; });
} else {
if (type === 'get') task = _get(url, conf);
else if (type === 'post') task = _post(url, item.body, conf);
else if (type === 'jsonp') task = _jsonp(url, conf);
}
return task;
});
return Promise.all(tasks);
}
tasks = items.forEach ==> tasks.items.map; 这个笔误 其实还很严重的;
写的挺不错,但是我没有看到你的,setResultToMemory,这个方法在获取得到参数之后进行设置,同时,你的get请求进行的缓存,没有考虑到query参数吧?因为我看你缓存的是一个path,路径,后面的参数都丢弃了,这肯定会造成缓存的数据混乱
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.