| Copyright | (c) Raghu Kaippully 2020 |
|---|---|
| License | MPL-2.0 |
| Maintainer | rkaippully@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
WebGear.Middlewares.Method
Description
Middlewares related to HTTP methods.
Synopsis
- data Method (t :: StdMethod)
- class IsStdMethod t where
- toStdMethod :: Proxy t -> StdMethod
- data MethodMismatch = MethodMismatch {}
- method :: forall t m req a. (IsStdMethod t, MonadRouter m) => RequestMiddleware' m req (Method t ': req) a
Documentation
data Method (t :: StdMethod) Source #
A Trait for capturing the HTTP method of a request
class IsStdMethod t where Source #
A typeclass to map a StdMethod from type level to term
level.
Instances
| IsStdMethod 'PATCH Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'OPTIONS Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'CONNECT Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'TRACE Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'DELETE Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'PUT Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'HEAD Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'POST Source # | |
Defined in WebGear.Middlewares.Method | |
| IsStdMethod 'GET Source # | |
Defined in WebGear.Middlewares.Method | |
data MethodMismatch Source #
Failure to match method against an expected value
Constructors
| MethodMismatch | |
Fields | |
method :: forall t m req a. (IsStdMethod t, MonadRouter m) => RequestMiddleware' m req (Method t ': req) a Source #
A middleware to check whether the request has a specified HTTP method.
Typically this would be used with a type application such as:
method @GET handler
It is also idiomatic to use the template haskell quasiquoter
match in cases where both HTTP method
and path needs to be matched.