MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / request

Function request

wxapp/fuyouhui.js:108–126  ·  view source on GitHub ↗
(method, urlPath, { token = "", data = null, params = null, headers = {} } = {})

Source from the content-addressed store, hash-verified

106}
107
108async function request(method, urlPath, { token = "", data = null, params = null, headers = {} } = {}) {
109 const res = await axios({
110 method,
111 url: `${API_BASE}${urlPath}`,
112 data,
113 params,
114 timeout: 15000,
115 validateStatus: () => true,
116 headers: {
117 version: "1.0",
118 "User-Agent": "Mozilla/5.0 MicroMessenger MiniProgramEnv/Windows",
119 Referer: `https://servicewechat.com/${MINI_APP_ID}/250/page-frame.html`,
120 "X-Call-Client-Info": clientInfo(),
121 ...(token ? { Authorization: `Bearer ${token}` } : {}),
122 ...headers,
123 },
124 });
125 return res.data;
126}
127
128function assertOk(res, action) {
129 if (!res || res.hasError || String(res.responseCode) !== "0") {

Callers 7

loginByOperateDataMethod · 0.70
getMemberInfoMethod · 0.70
getUserSignMethod · 0.70
queryAllRewardsMethod · 0.70
queryScrollScreenMethod · 0.70
queryPhotoMethod · 0.70
receiveCouponMethod · 0.70

Calls 1

clientInfoFunction · 0.85

Tested by

no test coverage detected