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

Method request

wxapp/hrj.js:182–195  ·  view source on GitHub ↗
(apiPath, data = {})

Source from the content-addressed store, hash-verified

180 }
181
182 async request(apiPath, data = {}) {
183 const res = await axios.post(`${API_BASE}${apiPath}`, this.buildWosBody(data), {
184 headers: this.getHeaders(),
185 timeout: 20000,
186 validateStatus: () => true,
187 });
188 if (res.status !== 200) throw new Error(`HTTP ${res.status}`);
189 if (`${res.data?.errcode}` !== "0") {
190 const error = new Error(res.data?.errmsg || `接口错误: ${res.data?.errcode || "unknown"}`);
191 error.data = res.data;
192 throw error;
193 }
194 return res.data?.data;
195 }
196
197 async getLoginCode() {
198 const { data } = await wechat.getCode(this.openid);

Callers 2

getSignMainInfoMethod · 0.95
doSignMethod · 0.95

Calls 3

buildWosBodyMethod · 0.95
getHeadersMethod · 0.95
postMethod · 0.45

Tested by

no test coverage detected