webgear-core-1.0.1: Composable, type-safe library to build HTTP APIs
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
TraitAbsence Method Request Source # 
Instance details

Defined in WebGear.Core.Trait.Method

Associated Types

type Absence Method Request Source #

Trait Method Request Source # 
Instance details

Defined in WebGear.Core.Trait.Method

Associated Types

type Attribute Method Request Source #

type Absence Method Request Source # 
Instance details

Defined in WebGear.Core.Trait.Method

type Attribute Method Request Source # 
Instance details

Defined in WebGear.Core.Trait.Method

data MethodMismatch Source #

Failure to match method against an expected value

method :: (Get h Method Request, ArrowChoice h, ArrowError RouteMismatch h) => StdMethod -> Middleware h req (Method ': req) 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.