Skip to content

Commit

Permalink
Removing an old bit of logic that was a stop gap for an earlier bug; …
Browse files Browse the repository at this point in the history
…you can now specify OPTIONS responses for proper API KT over the wire (that's the point of OPTIONS btw...)
  • Loading branch information
avoidwork committed Jul 10, 2018
1 parent 313638f commit 98fabf0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
40 changes: 18 additions & 22 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,31 +287,27 @@ function zuul (req, res, next) {
const uri = req.parsed.pathname;
let protectd = false;

if (regex.options.test(req.method) === false) {
retsu.each(req.server.config.auth.protect, i => {
if (i.test(uri) === true) {
return !(protectd = true);
}
retsu.each(req.server.config.auth.protect, i => {
if (i.test(uri) === true) {
return !(protectd = true);
}

return void 0;
});
return void 0;
});

// Setting state so the connection can be terminated properly
req.protect = protectd;
req.protectAsync = false;
// Setting state so the connection can be terminated properly
req.protect = protectd;
req.protectAsync = false;

rate(req, res, e => {
if (e !== void 0) {
res.error(e);
} else if (protectd === true) {
next();
} else {
keymaster(req, res, next);
}
});
} else {
res.send("OPTIONS requests are only support for CORS");
}
rate(req, res, e => {
if (e !== void 0) {
res.error(e);
} else if (protectd === true) {
next();
} else {
keymaster(req, res, next);
}
});
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an elastic REST API gateway for node.js",
"version": "8.0.2",
"version": "8.0.3",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit 98fabf0

Please sign in to comment.