Safe Haskell | None |
---|---|
Language | Haskell2010 |
WebGear.Core.Trait.Method
Description
Traits and middlewares to handle HTTP methods.
Synopsis
- newtype Method = Method StdMethod
- data MethodMismatch = MethodMismatch {}
- method :: forall h (ts :: [Type]). (Get h Method, ArrowChoice h, ArrowError RouteMismatch h) => StdMethod -> Middleware h ts (Method ': ts)
Documentation
A trait for capturing the HTTP method of a request
Instances
type Absence Method Source # | |
Defined in WebGear.Core.Trait.Method | |
type Attribute Method Request Source # | |
Defined in WebGear.Core.Trait.Method | |
type Prerequisite Method ts Source # | |
Defined in WebGear.Core.Trait.Method |
data MethodMismatch Source #
Failure to match method against an expected value
Constructors
MethodMismatch | |
Fields |
method :: forall h (ts :: [Type]). (Get h Method, ArrowChoice h, ArrowError RouteMismatch h) => StdMethod -> Middleware h ts (Method ': ts) Source #
Check whether the request has a specified HTTP method.
Example usage:
method @GET handler
If the request does not have the specified method, another handler will be tried.
It is also idiomatic to use the template haskell quasiquoter
match
or route
in
cases where both an HTTP method and a path need to be matched.