How to use the agent function from superagent
Find comprehensive JavaScript superagent.agent code examples handpicked from public code repositorys.
104 105 106 107 108 109 110 111 112 113
/* * Used to save and return cookies in a node.js (non-browser) setting, * if this.enableCookies is set to true. */ if (typeof window === 'undefined') { this.agent = new superagent.agent(); } // API Routes this.activityFeed = new ActivityFeed(this);
37
0
1
2 3 4 5 6 7 8 9 10 11
console.log('open library connector loading...') const URL = 'https://openlibrary.org/search.json?q=' exports.search = async (query) => { const agent = request.agent() const responseData = { books: [] } try { const searchRequest = await agent.get(URL + query).timeout(1000)
1
11
2
32 33 34 35 36 37 38 39 40 41 42 43
*/ exports.login = function (params) { params = params || {} // 保存Cookie var agent = request.agent() if (params.studentId && params.passWord) { // 登录图书馆 return agent
3
4
2
+ 9 other calls in file
superagent.get is the most popular function in superagent (1221 examples)