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

Function request

wxapp/yichengtong.js:119–141  ·  view source on GitHub ↗
(method, urlPath, { token = "", data = null, params = null, custom = {} } = {})

Source from the content-addressed store, hash-verified

117}
118
119async function request(method, urlPath, { token = "", data = null, params = null, custom = {} } = {}) {
120 const res = await axios({
121 method,
122 url: `${API_BASE}${urlPath}`,
123 data,
124 params,
125 timeout: 30000,
126 validateStatus: () => true,
127 headers: {
128 Accept: "*/*",
129 "Content-Type": "application/json",
130 "User-Agent": "Mozilla/5.0 MicroMessenger MiniProgramEnv/Windows",
131 Referer: `https://servicewechat.com/${MINI_APP_ID}/${PACKAGE_VERSION}/page-frame.html`,
132 ...(token ? { Authorization: `Bearer ${token}` } : {}),
133 },
134 ...custom,
135 });
136 return {
137 status: res.status,
138 data: res.data,
139 text: typeof res.data === "string" ? res.data : JSON.stringify(res.data),
140 };
141}
142
143class Task {
144 constructor(raw) {

Callers 3

loginByCodeMethod · 0.70
loginByOperateDataMethod · 0.70
apiMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected