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

Safe HaskellNone
LanguageHaskell98

Network.HTTP.Client.Conduit

Contents

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

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

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