MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / gateway

Function gateway

wxapp/ctrip.js:149–163  ·  view source on GitHub ↗
(pathname, data)

Source from the content-addressed store, hash-verified

147}
148
149async function gateway(pathname, data) {
150 const res = await axios.post(`${PASSPORT_BASE}/${pathname}`, JSON.stringify(data), {
151 timeout: 30000,
152 validateStatus: () => true,
153 headers: {
154 "Content-Type": "application/json",
155 "User-Agent": "Mozilla/5.0 MicroMessenger MiniProgramEnv/Windows",
156 Referer: `https://servicewechat.com/${MINI_APP_ID}/${PACKAGE_VERSION}/page-frame.html`,
157 },
158 });
159 if (res.status !== 200 || Number(res.data?.ReturnCode) !== 0) {
160 throw new Error(`${pathname}失败: ${JSON.stringify(res.data)}`);
161 }
162 return parseJsonMaybe(res.data.Result || "{}");
163}
164
165async function h5Api(pathname, data, account) {
166 const cookies = [];

Callers 1

loginMethod · 0.85

Calls 2

parseJsonMaybeFunction · 0.85
postMethod · 0.45

Tested by

no test coverage detected