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

Function accountRequest

wxapp/wps.js:215–236  ·  view source on GitHub ↗
(method, urlPath, { data = null, cookies = {}, secret = "" } = {})

Source from the content-addressed store, hash-verified

213}
214
215async function accountRequest(method, urlPath, { data = null, cookies = {}, secret = "" } = {}) {
216 const url = `${ACCOUNT_BASE}${urlPath}`;
217 const headers = {
218 platform: "wx_mini",
219 app_name: "account_wx_mini_plugin",
220 Cookie: `csrf=1234567890${cookieHeader(cookies) ? `;${cookieHeader(cookies)}` : ""}`,
221 "X-CSRFToken": "1234567890",
222 "User-Agent": "Mozilla/5.0 MicroMessenger MiniProgramEnv/Windows",
223 Referer: `https://servicewechat.com/${MINI_APP_ID}/249/page-frame.html`,
224 };
225 const pop = makePopToken(method, urlPath, secret, cookies.cv || "");
226 if (pop) headers["X-Pop-Token"] = pop;
227 const res = await axios({
228 method,
229 url,
230 data,
231 headers,
232 timeout: 20000,
233 validateStatus: () => true,
234 });
235 return { data: res.data, cookies: mergeSetCookie(res.headers["set-cookie"], cookies), status: res.status };
236}
237
238async function wpsRequest(method, url, { data = null, params = null, cookies = {}, secret = "", signed = false, clockConfig = {}, headers: extraHeaders = {} } = {}) {
239 const csrf = "1234567890";

Callers 1

loginMethod · 0.85

Calls 3

cookieHeaderFunction · 0.85
makePopTokenFunction · 0.85
mergeSetCookieFunction · 0.85

Tested by

no test coverage detected