Safe Haskell | None |
---|---|
Language | Haskell98 |
A new, experimental API to replace Network.HTTP.Conduit.
For more information, please be sure to read the documentation in the Network.HTTP.Client module.
- withResponse :: (MonadBaseControl IO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a
- responseOpen :: (MonadIO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Response (ConduitM i ByteString n ()))
- responseClose :: MonadIO m => Response body -> m ()
- acquireResponse :: (MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Acquire (Response (ConduitM i ByteString n ())))
- defaultManagerSettings :: ManagerSettings
- newManager :: MonadIO m => m Manager
- withManager :: MonadIO m => ReaderT Manager m a -> m a
- withManagerSettings :: MonadIO m => ManagerSettings -> ReaderT Manager m a -> m a
- newManagerSettings :: MonadIO m => ManagerSettings -> m Manager
- class HasHttpManager a where
- getHttpManager :: a -> Manager
- module Network.HTTP.Client
- httpLbs :: (MonadIO m, HasHttpManager env, MonadReader env m) => Request -> m (Response ByteString)
- httpNoBody :: (MonadIO m, HasHttpManager env, MonadReader env m) => Request -> m (Response ())
- requestBodySource :: Int64 -> Source IO ByteString -> RequestBody
- requestBodySourceChunked :: Source IO ByteString -> RequestBody
- bodyReaderSource :: MonadIO m => BodyReader -> Producer m ByteString
Conduit-specific interface
withResponse :: (MonadBaseControl IO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a Source
Conduit powered version of withResponse
. Differences are:
- Response body is represented as a
Producer
. - Generalized to any instance of
MonadBaseControl
, not justIO
. - The
Manager
is contained by aMonadReader
context.
Since 2.1.0
responseOpen :: (MonadIO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Response (ConduitM i ByteString n ())) Source
Conduit-powered version of responseOpen
.
See withResponse
for the differences with responseOpen
.
Since 2.1.0
responseClose :: MonadIO m => Response body -> m () Source
Generalized version of responseClose
.
Since 2.1.0
acquireResponse :: (MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Acquire (Response (ConduitM i ByteString n ()))) Source
An Acquire
for getting a Response
.
Since 2.1.0
Manager helpers
defaultManagerSettings :: ManagerSettings Source
TLS-powered manager settings.
Since 2.1.0
newManager :: MonadIO m => m Manager Source
Get a new manager using defaultManagerSettings
.
Since 2.1.0
withManager :: MonadIO m => ReaderT Manager m a -> m a Source
Get a new manager with defaultManagerSettings
and construct a ReaderT
containing it.
Since 2.1.0
withManagerSettings :: MonadIO m => ManagerSettings -> ReaderT Manager m a -> m a Source
Get a new manager with the given settings and construct a ReaderT
containing it.
Since 2.1.0
newManagerSettings :: MonadIO m => ManagerSettings -> m Manager Source
Get a new manager using the given settings.
Since 2.1.0
General HTTP client interface
module Network.HTTP.Client
httpLbs :: (MonadIO m, HasHttpManager env, MonadReader env m) => Request -> m (Response ByteString) Source
Same as httpLbs
, except it uses the Manager
in the reader environment.
Since 2.1.1
httpNoBody :: (MonadIO m, HasHttpManager env, MonadReader env m) => Request -> m (Response ()) Source
Same as httpNoBody
, except it uses the Manager
in the reader environment.
This can be more convenient that using withManager
as it avoids the need
to specify the base monad for the response body.
Since 2.1.2
Lower-level conduit functions
requestBodySource :: Int64 -> Source IO ByteString -> RequestBody Source
bodyReaderSource :: MonadIO m => BodyReader -> Producer m ByteString Source