jester icon indicating copy to clipboard operation
jester copied to clipboard

Before filters in child routers leak into the parent

Open Xe opened this issue 4 years ago • 1 comments

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.

Xe avatar Aug 24 '19 20:08 Xe

https://irclogs.nim-lang.org/24-08-2019.html#20:56:17

dom96 avatar Aug 24 '19 20:08 dom96