MCPcopy Create free account
hub / github.com/badyun/AShare / http

Method http

utils/cloud.js:44–65  ·  view source on GitHub ↗
(url, params = {})

Source from the content-addressed store, hash-verified

42
43 // 请求
44 async http(url, params = {}) {
45 return new Promise(async (resolve, reject) => {
46 try {
47 let s = await superagent.post(url)
48 .set({
49 authorization: 'Bearer ' + this.info.access_token,
50 referer: 'https://www.aliyundrive.com/',
51 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36'
52 })
53 .send(params)
54 resolve(s.body)
55 } catch (error) {
56 if (error.status == 401) {
57 await this.login()
58 return this.http(url, params)
59 } else {
60 reject(error.response.body.message)
61 }
62 }
63 })
64
65 }
66
67 // 获取人信息
68 async getInfo() {

Callers 5

getInfoMethod · 0.80
listMethod · 0.80
nodeMethod · 0.80
previewVideoMethod · 0.80
fileInfoMethod · 0.80

Calls 1

loginMethod · 0.80

Tested by

no test coverage detected