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

Method h5Request

wxapp/oppo.js:183–197  ·  view source on GitHub ↗
(method, path, data = {})

Source from the content-addressed store, hash-verified

181 }
182
183 async h5Request(method, path, data = {}) {
184 const upperMethod = method.toUpperCase();
185 const { status, data: result } = await request({
186 method: upperMethod,
187 url: `${H5_API}${path}`,
188 headers: this.h5Headers(),
189 params: upperMethod === "GET" ? data : undefined,
190 data: upperMethod === "GET" ? undefined : data,
191 });
192 if (status !== 200) throw new Error(`${path} HTTP ${status}: ${short(result)}`);
193 if (Number(result?.code) !== 200 && result?.succeed !== true) {
194 throw new Error(`${path} 失败: ${result?.message || result?.errorMessage || short(result)}`);
195 }
196 return result;
197 }
198
199 async login() {
200 if (!this.account.openid) throw new Error("账号格式错误,请配置 wx_server 里的 openid");

Callers 2

getSignDetailMethod · 0.95
signInMethod · 0.95

Calls 3

h5HeadersMethod · 0.95
requestFunction · 0.70
shortFunction · 0.70

Tested by

no test coverage detected