(req, res, next)
| 15 | `; |
| 16 | |
| 17 | const 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 | |
| 31 | recaptchaRouter.get('/mock.js', (_req, res) => { |
| 32 | res.end(recaptchaMock); |