MCPcopy Index your code
hub / github.com/ampproject/amphtml / recaptchaFrameRequestHandler

Function recaptchaFrameRequestHandler

build-system/server/recaptcha-router.js:17–29  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

15`;
16
17const recaptchaFrameRequestHandler = (req, res, next) => {
18 if (argv._.includes('unit') || argv._.includes('integration')) {
19 fs.promises.readFile(pc.cwd() + req.path, 'utf8').then((file) => {
20 file = file.replace(
21 /initRecaptcha\(.*\)/g,
22 'initRecaptcha("/recaptcha/mock.js?sitekey=")'
23 );
24 res.end(file);
25 });
26 } else {
27 next();
28 }
29};
30
31recaptchaRouter.get('/mock.js', (_req, res) => {
32 res.end(recaptchaMock);

Callers

nothing calls this directly

Calls 3

nextFunction · 0.50
thenMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected