MCPcopy Create free account
hub / github.com/Semporia/Scripts / injectToRequest

Function injectToRequest

JDJRValidator_Pure.js:494–512  ·  view source on GitHub ↗
(fn,scene = 'cww')

Source from the content-addressed store, hash-verified

492}
493
494function injectToRequest(fn,scene = 'cww') {
495 return (opts, cb) => {
496 fn(opts, async (err, resp, data) => {
497 if (err) {
498 console.error(JSON.stringify(err));
499 return;
500 }
501 if (data.search('验证') > -1) {
502 console.log('JDJR验证中......');
503 const res = await new JDJRValidator().run(scene);
504
505 opts.url += `&validate=${res.validate}`;
506 fn(opts, cb);
507 } else {
508 cb(err, resp, data);
509 }
510 });
511 };
512}
513
514exports.injectToRequest = injectToRequest;

Callers

nothing calls this directly

Calls 3

errorMethod · 0.80
logMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected