scotty-web / scotty

Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp (Official Repository)
http://hackage.haskell.org/package/scotty
BSD 3-Clause "New" or "Revised" License
1.72k stars 134 forks source link

Scotty doesn't work with wai-extra middleware MethodOverride #267

Closed thaldyron closed 4 years ago

thaldyron commented 4 years ago

I'm trying to use methodOverride from the wai-extra package (module Network.Wai.Middleware.MethodOverride), which rewrites POST requests that have a _method parameter to contain the correct HTTP method, e.g., DELETE.

I've added middleware methodOverride to my list of handlers, but it doesn't work. The reason for this seems to be that, internally, methodOverride uses queryString (from Network.Wai) to extract the _method parameter of the Request, but I noticed that in the passed Request the query string is empty for some reason.

That said, _method and the other parameters that I'm passing do show up when I query them later on with param in ScottyT, so it seems that Scotty somehow has removed them from Request but keeps track of them in its own state.

thaldyron commented 4 years ago

See https://github.com/scotty-web/scotty/issues/7