webgear-server-0.2.1: Composable, type-safe library to build HTTP API servers
Copyright(c) Raghu Kaippully 2020
LicenseMPL-2.0
Maintainerrkaippully@gmail.com
Safe HaskellNone
LanguageHaskell2010

WebGear.Middlewares.Method

Description

Middlewares related to HTTP methods.

Synopsis

Documentation

data Method (t :: StdMethod) Source #

A Trait for capturing the HTTP method of a request

Instances

Instances details
(IsStdMethod t, Monad m) => Trait (Method t :: Type) Request m Source # 
Instance details

Defined in WebGear.Middlewares.Method

Associated Types

type Attribute (Method t) Request Source #

type Absence (Method t) Request Source #

type Attribute (Method t :: Type) Request Source # 
Instance details

Defined in WebGear.Middlewares.Method

type Attribute (Method t :: Type) Request = ()
type Absence (Method t :: Type) Request Source # 
Instance details

Defined in WebGear.Middlewares.Method

class IsStdMethod t where Source #

A typeclass to map a StdMethod from type level to term level.

Methods

toStdMethod :: Proxy t -> StdMethod Source #

Convert t to term level.

data MethodMismatch Source #

Failure to match method against an expected value

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.