webgear-core
Safe HaskellNone
LanguageHaskell2010

WebGear.Core.Trait.Method

Description

Traits and middlewares to handle HTTP methods.

Synopsis

Documentation

newtype Method Source #

A trait for capturing the HTTP method of a request

Constructors

Method StdMethod 

Instances

Instances details
type Absence Method Source # 
Instance details

Defined in WebGear.Core.Trait.Method

type Attribute Method Request Source # 
Instance details

Defined in WebGear.Core.Trait.Method

type Prerequisite Method ts Source # 
Instance details

Defined in WebGear.Core.Trait.Method

type Prerequisite Method ts = ()

data MethodMismatch Source #

Failure to match method against an expected value

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.