module Main (main) where
import Web.Scotty
main :: IO ()
main = scotty 3000 $
get "/:some_named_capture" $ do
val <- param "some_named_capture"
text val
When requesting the url "/:some_named_capture" exactly, the value is not captured at all as it matches literally. This results in the param call failing.
I actually discovered this whilst reading through scotty's source and noticing the order of the guards in the go function within matchRoute. Specifically, the equal literals case is checked before the p is a capture case, which should probably be first for the expected behaviour.
Minimal reproduction:
When requesting the url "/:some_named_capture" exactly, the value is not captured at all as it matches literally. This results in the
param
call failing.I actually discovered this whilst reading through scotty's source and noticing the order of the guards in the go function within matchRoute. Specifically, the
equal literals
case is checked before thep is a capture
case, which should probably be first for the expected behaviour.