Network.HTTP.Client.Conduit

http-conduit-2.2.3.1: HTTP client package with conduit interface and HTTPS support.

Safe Haskell | None
Language | Haskell98

Network.HTTP.Client.Conduit

Contents

- Conduit-specific interface
- Manager helpers
- General HTTP client interface
- Lower-level conduit functions

Description

A new, experimental API to replace Network.HTTP.Conduit.

For most users, Network.HTTP.Simple is probably a better choice. For more information, see:

https://haskell-lang.org/library/http-client

For more information on using this module, please be sure to read the documentation in the Network.HTTP.Client module.

Synopsis

- 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
- 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 #

Conduit powered version of `withResponse`. Differences are:

- Response body is represented as a `Producer`.
- Generalized to any instance of `MonadBaseControl`, not just `IO`.
- The `Manager` is contained by a `MonadReader` context.

Since 2.1.0

responseOpen :: (MonadIO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Response (ConduitM i ByteString n ())) #

Conduit-powered version of `responseOpen`.

See `withResponse` for the differences with `responseOpen`.

Since 2.1.0

responseClose :: MonadIO m => Response body -> m () #

Generalized version of `responseClose`.

Since 2.1.0

acquireResponse :: (MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Acquire (Response (ConduitM i ByteString n ()))) #

An `Acquire` for getting a `Response`.

Since 2.1.0

# Manager helpers

defaultManagerSettings :: ManagerSettings #

TLS-powered manager settings.

Since 2.1.0

newManager :: MonadIO m => m Manager #

Get a new manager using `defaultManagerSettings`.

Since 2.1.0

withManager :: MonadIO m => ReaderT Manager m a -> m a #

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 #

Get a new manager with the given settings and construct a `ReaderT` containing it.

Since 2.1.0

newManagerSettings :: MonadIO m => ManagerSettings -> m Manager #

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) #

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 ()) #

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 #

requestBodySourceChunked :: Source IO ByteString -> RequestBody #

bodyReaderSource :: MonadIO m => BodyReader -> Producer m ByteString #