Closed redneb closed 7 years ago
We currently don't have that in Spock as we have a separate "routing table" per method. You can still implement this combinator easily by iterating over all possible methods and wiring them up. Something like:
hookMethodAny path handler =
forM_ [minBound..maxBound] $ \myMethod ->
hookRoute myMethod path $ handler myMethod
Yeah, this is what I do currently. I was hopping for something more general, although I suspect that my application (which simply forwards requests to another server) will not encounter any nonstandard HTTP methods.
Another application that I had in mind, is the notFound
route that scotty
offers. Is there some other sensible way to implement this in Spock
?
Hi, is there a way to add a route that matches regardless of the HTTP method used?
scotty
hasmatchAny
. It would also be nice to be able to find out what method was actually used.