MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / request

Method request

wxapp/iqoo.js:192–208  ·  view source on GitHub ↗
(apiPath, data = {}, options = {})

Source from the content-addressed store, hash-verified

190 }
191
192 async request(apiPath, data = {}, options = {}) {
193 const method = (options.method || "POST").toUpperCase();
194 const req = {
195 method,
196 url: new URL(apiPath, API_BASE).toString(),
197 headers: this.headers(method, apiPath, data, options.headers || {}),
198 timeout: 20000,
199 validateStatus: () => true,
200 };
201 if (method === "GET") req.params = data;
202 else req.data = data || {};
203
204 const { data: result, status } = await axios.request(req);
205 if (status !== 200) throw new Error(`HTTP ${status}: ${JSON.stringify(result)}`);
206 if (!isSuccess(result)) throw new Error(`${result?.Code ?? ""} ${result?.Message || JSON.stringify(result)}`.trim());
207 return result;
208 }
209
210 async getOperateData() {
211 if (!process.env.wx_auth) throw new Error("缺少 wx_auth,无法从 wx_server 获取登录数据");

Callers 12

loginByWxCodeMethod · 0.95
checkTokenMethod · 0.95
userInfoRequestMethod · 0.95
getDrawNumMethod · 0.95
drawMethod · 0.95
signInMethod · 0.95
likePostMethod · 0.95
sharePostMethod · 0.95
viewPostMethod · 0.95
commonPostMethod · 0.95
getTreadListMethod · 0.95
getNoticeFunction · 0.45

Calls 2

headersMethod · 0.95
isSuccessFunction · 0.70

Tested by

no test coverage detected