linnet-0.4.0.1: Lightweight library for building HTTP API

Safe HaskellNone
LanguageHaskell2010

Linnet.Endpoints.Bodies

Synopsis

Documentation

body :: forall ct a m. (Decode ct a, MonadIO m, MonadThrow m) => Endpoint m a Source #

Endpoint that tries to decode body of request into some type a using corresponding Decode instance. Matches if body isn't chunked. May throw an exception in case:

  • Body is empty
  • There was a body decoding error

bodyMaybe :: forall ct a m. (Decode ct a, MonadIO m, MonadThrow m) => Endpoint m (Maybe a) Source #

Endpoint that tries to decode body of request into some type a using corresponding Decode instance. Matches if body isn't chunked. May throw an exception in case:

  • There was a body decoding error

jsonBody :: (Decode ApplicationJson a, MonadIO m, MonadThrow m) => Endpoint m a Source #

Alias for body @ApplicationJson

jsonBodyMaybe :: (Decode ApplicationJson a, MonadIO m, MonadThrow m) => Endpoint m (Maybe a) Source #

Alias for bodyMaybe @ApplicationJson

textBody :: (Decode TextPlain a, MonadIO m, MonadThrow m) => Endpoint m a Source #

Alias for body @TextPlain

textBodyMaybe :: (Decode TextPlain a, MonadIO m, MonadThrow m) => Endpoint m (Maybe a) Source #

Alias for bodyMaybe @TextPlain