| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Servant.Common.Req
Contents
- data ServantError
- = FailureResponse {
- responseStatus :: Status
- responseContentType :: MediaType
- responseBody :: ByteString
- | DecodeFailure {
- decodeError :: String
- responseContentType :: MediaType
- responseBody :: ByteString
- | UnsupportedContentType {
- responseContentType :: MediaType
- responseBody :: ByteString
- | InvalidContentTypeHeader { }
- | ConnectionError { }
- = FailureResponse {
- data Req = Req {}
- defReq :: Req
- appendToPath :: String -> Req -> Req
- appendToQueryString :: Text -> Maybe Text -> Req -> Req
- addHeader :: ToHttpApiData a => String -> a -> Req -> Req
- setRQBody :: ByteString -> MediaType -> Req -> Req
- reqToRequest :: (Functor m, MonadThrow m) => Req -> BaseUrl -> m Request
- displayHttpRequest :: Method -> String
- data ClientEnv = ClientEnv {}
- newtype ClientM a = ClientM {
- runClientM' :: ReaderT ClientEnv (ExceptT ServantError IO) a
- runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a)
- performRequest :: Method -> Req -> ClientM (Int, ByteString, MediaType, [Header], Response ByteString)
- performRequestCT :: MimeUnrender ct result => Proxy ct -> Method -> Req -> ClientM ([Header], result)
- performRequestNoBody :: Method -> Req -> ClientM [Header]
- catchConnectionError :: IO a -> IO (Either ServantError a)
Documentation
data ServantError Source #
Constructors
| FailureResponse | |
Fields
| |
| DecodeFailure | |
Fields
| |
| UnsupportedContentType | |
Fields
| |
| InvalidContentTypeHeader | |
Fields | |
| ConnectionError | |
Fields | |
Instances
| Eq ServantError Source # | |
| Show ServantError Source # | |
| Exception ServantError Source # | |
| MonadError ServantError ClientM Source # | |
reqToRequest :: (Functor m, MonadThrow m) => Req -> BaseUrl -> m Request Source #
performing requests
displayHttpRequest :: Method -> String Source #
ClientM is the monad in which client functions run. Contains the
Manager and BaseUrl used for requests in the reader environment.
Constructors
| ClientM | |
Fields
| |
Instances
runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a) Source #
performRequest :: Method -> Req -> ClientM (Int, ByteString, MediaType, [Header], Response ByteString) Source #
performRequestCT :: MimeUnrender ct result => Proxy ct -> Method -> Req -> ClientM ([Header], result) Source #
performRequestNoBody :: Method -> Req -> ClientM [Header] Source #
catchConnectionError :: IO a -> IO (Either ServantError a) Source #