@@ -8,11 +8,15 @@ import Control.Monad (join)
9-- | Allows overriding of the HTTP request method via the _method query string
9-- | Allows overriding of the HTTP request method via the _method query string
10-- parameter.
10-- parameter.
12+-- This middlware only applies when the initial request method is POST. This
13+-- allow submitting of normal HTML forms, without worries of semantics
14+-- mismatches in the HTTP spec.
11methodOverride :: Middleware
15methodOverride :: Middleware
12methodOverride app req =
16methodOverride app req =
16− case join $ lookup "_method" $ queryString req of
20+ case (requestMethod m, join $ lookup "_method" $ queryString req) of
18− Just m -> req { requestMethod = m }
21+ ("POST", Just m) -> req { requestMethod = m }