dom96 / jester

A sinatra-like web framework for Nim.
MIT License
1.57k stars 120 forks source link

Conditions don't work #259

Closed zolomatok closed 3 years ago

zolomatok commented 4 years ago

The example given in the README on the use of conds don't work.

routes:
  get "/@name":
    cond @"name" != "daniel"
    # ``cond`` will pass execution to the next matching route if @"name" is not
    # "daniel".
    resp "Correct, my name is daniel."

  get "/@name":
    # This will be the next route that is matched.
    resp "No, that's not my name."

This will always resolve to Correct, my name is daniel, even if you visit localhost:500/duke

Jester 0.4.3

oal commented 3 years ago

Conditions work fine in 0.5.0, and it differentiates between the two. But it should be cond @"name" == "daniel" for the first route. Currently it says "Correct, my name is daniel" when you go to anything but /daniel, and "No that's not my name" for /daniel.