Using serveDirectory can break routing #125

zopa opened this Issue Mar 9, 2012 · 0 comments


None yet

2 participants

zopa commented Mar 9, 2012

Using snap init barebones and this route table:

route [ ("article",      serveDirectory "resources/static")
      , ("article/:id",  writeBS "Why am I here?")

a request for "/article" returns "Why am I here?", rather than the expected contents of "resources/static/index.html".

Snap, given a call to serveDirectory, appends a trailing slash to the url and then appears to double back through the route table with the new URL; on the second pass "/article/" matches "/article/:id". This is strange: when I route a request to a handler I expect it to stay there, absent an explicit transfer of control.

Replacing serveDirectory "resources/static" with writeBS "index" outputs "index", as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment