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

Method request

wxapp/campari.js:132–145  ·  view source on GitHub ↗
(apiPath, data = {}, token = this.session.token)

Source from the content-addressed store, hash-verified

130 }
131
132 async request(apiPath, data = {}, token = this.session.token) {
133 const res = await axios.post(`${API_BASE}${apiPath}`, data || {}, {
134 headers: this.getHeaders(token),
135 timeout: 20000,
136 validateStatus: () => true,
137 });
138 if (res.status !== 200) throw new Error(`HTTP ${res.status}`);
139 if (Number(res.data?.code) !== 200) {
140 const error = new Error(res.data?.msg || `接口错误: ${res.data?.code || "unknown"}`);
141 error.data = res.data;
142 throw error;
143 }
144 return res.data;
145 }
146
147 async getLoginCode() {
148 const { data } = await wechat.getCode(this.openid);

Callers 3

loginByWxCodeMethod · 0.95
refreshTokenMethod · 0.95
getSignInfoMethod · 0.95

Calls 2

getHeadersMethod · 0.95
postMethod · 0.45

Tested by

no test coverage detected