jester
jester copied to clipboard
Before filters in child routers leak into the parent
import asyncdispatch, jester
settings:
port = Port(9001)
router api:
before:
try:
discard request.cookies["auth_token"]
except:
halt Http403, "permission denied"
routes:
extend api, "/api"
get "/":
resp Http200, "hahaha it's is an laughter image"
When this code is running, you can never get to the message on /
without having the auth_token
cookie set. This was surprising, as I expected the before filter to only run on routes under /api
.
https://irclogs.nim-lang.org/24-08-2019.html#20:56:17