summaryrefslogtreecommitdiff
path: root/Run/Que/Server.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-08 12:03:44 -0700
committerBen Sima <ben@bsima.me>2020-04-08 20:01:25 -0700
commit8bd53b74bbb826312263d77326f2d8740c99924a (patch)
treec4b22f2528001b60ec85b79b9aa489bb0317f3e3 /Run/Que/Server.hs
parent751b725332fd0e9397b7cfd3f3a3bff14056c232 (diff)
Finish the request after guarding
This prevents and further code from being executed. I think this was happening so posted messages were still going on the que even though I said they weren't. I really need some tests.
Diffstat (limited to 'Run/Que/Server.hs')
-rw-r--r--Run/Que/Server.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/Run/Que/Server.hs b/Run/Que/Server.hs
index 146a16a..5973ec2 100644
--- a/Run/Que/Server.hs
+++ b/Run/Que/Server.hs
@@ -131,6 +131,7 @@ routes = do
when ("_" == ns && authkey /= adminkey)
<| Scotty.status Http.methodNotAllowed405
>> Scotty.text "not allowed: _ is a reserved namespace"
+ >> Scotty.finish
guardNs ns ["pub", "_"]
-- passed all auth checks
app . modify <| upsertNamespace ns
@@ -148,6 +149,7 @@ guardNs ns whitelist = when (not <| ns `elem` whitelist) <| do
<| "not allowed: use 'pub' namespace or signup to protect '"
<> ns
<> "' at https://que.run"
+ Scotty.finish
-- | recover from a scotty-thrown exception.
(!:)