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

Function h5Api

wxapp/ctrip.js:165–186  ·  view source on GitHub ↗
(pathname, data, account)

Source from the content-addressed store, hash-verified

163}
164
165async function h5Api(pathname, data, account) {
166 const cookies = [];
167 if (account.ticket) cookies.push(`cticket=${account.ticket}`);
168 if (account.duid) cookies.push(`DUID=${encodeURIComponent(account.duid)}`);
169 if (account.udl) cookies.push(`_udl=${account.udl}`);
170 cookies.push(`GUID=${CLIENT_ID}`);
171 const res = await axios.post(`${API_BASE}${pathname}`, JSON.stringify(data || {}), {
172 timeout: 30000,
173 validateStatus: () => true,
174 headers: {
175 "Content-Type": "application/json",
176 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 MicroMessenger/3.9.12 MiniProgramEnv/Windows WindowsWechat/WMPF",
177 Referer: "https://m.ctrip.com/",
178 Cookie: `${cookies.join("; ")};`,
179 },
180 });
181 return {
182 status: res.status,
183 data: res.data,
184 text: typeof res.data === "string" ? res.data : JSON.stringify(res.data),
185 };
186}
187
188class Task {
189 constructor(raw) {

Callers 2

signMethod · 0.85
h5ModelMethod · 0.85

Calls 1

postMethod · 0.45

Tested by

no test coverage detected