MCPcopy Create free account
hub / github.com/avoidwork/tenso / zuul

Function zuul

src/middleware/zuul.js:11–37  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

9 * @returns {void}
10 */
11export function zuul (req, res, next) {
12 const uri = req.url;
13 let protect = false;
14
15 if (req.unprotect === false) {
16 for (const i of req.server.auth.protect) {
17 if (i.test(uri)) {
18 protect = true;
19 break;
20 }
21 }
22 }
23
24 // Setting state so the connection can be terminated properly
25 req.protect = protect;
26 req.protectAsync = false;
27
28 rate(req, res, e => {
29 if (e !== void 0) {
30 res.error(e);
31 } else if (protect) {
32 next();
33 } else {
34 req.exit();
35 }
36 });
37}

Callers 1

Calls 1

rateFunction · 0.90

Tested by

no test coverage detected