servant-routes
Copyright(c) Frederick Pringle 2025
LicenseBSD-3-Clause
Maintainerfrederick.pringle@fpringle.com
Safe HaskellNone
LanguageHaskell2010

Servant.API.Routes.Request

Description

Term-level representation of the request bodies that Servant endpoints expect.

Synopsis

Documentation

data Request Source #

A representation of the request body(s) that a Servant endpoint expects.

Under the hood, Request is a Some TypeRep. This allows for the possibility that an endpoint might expect the request body to parse as several different types (multiple ReqBody's).

Note that this type doesn't include any information about the headers that an endpoint expects, since those are independent of the request body.

noRequest :: Request Source #

The endpoint doesn't expect a request body.

oneRequest :: Typeable a => Request Source #

The request body can only be of one type. Equivalent to a single ReqBody _ a.

allOfRequests :: forall (as :: [Type]). AllTypeable as => Request Source #

The endpoint expects the request body to be parsed as multiple (>1) types. Equivalent to multiple ReqBodys chained with :>.

requests :: Traversal' Request TypeRep Source #

Convenience optic to traverse over all the TypeReps within a Request.