I'm having an issue with the Scotty web server right now - rescue
isn't working for unfound parameters - I'm still getting a 404 with the following code:
post "/newsletter/create" ( do
(param "subscriber[email]") `rescue` (\msg -> text msg)
formContent <- param "subscriber[email]"
text $ "found! " ++ show formContent )
I can see that when I just use params
instead, my data is there, and indexed with "subscriber[email]
". Is there something going on with [
escaping? Any help with this would be tremendous.
With some cleanup I got it to work:
I made a bunch of modifications, but the key point was that
rescue
is used as a wrapper aroundparam
, not to change any internal state, hence you shouldn't call it twice. The square brackets didn't cause me any trouble.