Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype HttpT m a = HttpT {}
- type Http = HttpT IO
- class MonadHttp m where
- handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> m a
- handleRequest :: MonadHttp m => Request -> m (Response (Maybe LByteString))
- data Debug
- runHttpT :: Manager -> HttpT m a -> m a
- http :: MonadHttp m => Request -> (Request -> Request) -> (Response BodyReader -> IO a) -> m a
- httpLbs :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- httpDebug :: (MonadIO m, MonadHttp m) => Debug -> Request -> (Request -> Request) -> (Response (Maybe LByteString) -> IO a) -> m a
- get :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- get' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- put :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- put' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- post :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- post' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- head :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- head' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- delete :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- delete' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- options :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- options' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- trace :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- trace' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- patch :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString))
- patch' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString))
- consumeBody :: Response BodyReader -> IO (Response (Maybe ByteString))
- data ManagerSettings
- withResponse :: Request -> Manager -> (Response BodyReader -> IO a) -> IO a
- data Manager
- newManager :: ManagerSettings -> IO Manager
- withManager :: ManagerSettings -> (Manager -> IO a) -> IO a
- defaultManagerSettings :: ManagerSettings
- type BodyReader = IO ByteString
- brRead :: BodyReader -> IO ByteString
- brConsume :: BodyReader -> IO [ByteString]
- data HttpException
Convenience API
Instances
class MonadHttp m where Source #
handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> m a Source #
Instances
MonadHttp Session Source # | |
Defined in Bilge.IO handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> Session a Source # | |
MonadIO m => MonadHttp (HttpT m) Source # | |
Defined in Bilge.IO handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> HttpT m a Source # | |
MonadIO m => MonadHttp (SessionT m) Source # | |
Defined in Bilge.IO handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> SessionT m a Source # | |
(MonadTrans t, MonadHttp m, Monad m) => MonadHttp (t m) Source # | |
Defined in Bilge.IO handleRequestWithCont :: Request -> (Response BodyReader -> IO a) -> t m a Source # |
handleRequest :: MonadHttp m => Request -> m (Response (Maybe LByteString)) Source #
Debug settings may cause debug information to be printed to stdout.
http :: MonadHttp m => Request -> (Request -> Request) -> (Response BodyReader -> IO a) -> m a Source #
httpLbs :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
httpDebug :: (MonadIO m, MonadHttp m) => Debug -> Request -> (Request -> Request) -> (Response (Maybe LByteString) -> IO a) -> m a Source #
get :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
put :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
post :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
post' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
head :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
head' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
delete :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
delete' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
options :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
options' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
trace :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
trace' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
patch :: MonadHttp m => (Request -> Request) -> m (Response (Maybe LByteString)) Source #
Given a Request
builder function, perform an actual HTTP request using the
respective method and return the response, fully consuming the response body
as a lazy ByteString
.
patch' :: MonadHttp m => Request -> (Request -> Request) -> m (Response (Maybe LByteString)) Source #
consumeBody :: Response BodyReader -> IO (Response (Maybe ByteString)) Source #
Re-exports
data ManagerSettings Source #
Settings for a Manager
. Please use the defaultManagerSettings
function and then modify
individual settings. For more information, see http://www.yesodweb.com/book/settings-types.
Since 0.1.0
withResponse :: Request -> Manager -> (Response BodyReader -> IO a) -> IO a Source #
Perform a Request
using a connection acquired from the given Manager
,
and then provide the Response
to the given function. This function is
fully exception safe, guaranteeing that the response will be closed when the
inner function exits. It is defined as:
withResponse req man f = bracket (responseOpen req man) responseClose f
It is recommended that you use this function in place of explicit calls to
responseOpen
and responseClose
.
You will need to use functions such as brRead
to consume the response
body.
Since 0.1.0
Keeps track of open connections for keep-alive.
If possible, you should share a single Manager
between multiple threads and requests.
Since 0.1.0
Instances
newManager :: ManagerSettings -> IO Manager Source #
Create a Manager
. The Manager
will be shut down automatically via
garbage collection.
Creating a new Manager
is a relatively expensive operation, you are
advised to share a single Manager
between requests instead.
The first argument to this function is often defaultManagerSettings
,
though add-on libraries may provide a recommended replacement.
Since 0.1.0
withManager :: ManagerSettings -> (Manager -> IO a) -> IO a Source #
Create, use and close a Manager
.
Since 0.2.1
defaultManagerSettings :: ManagerSettings Source #
Default value for ManagerSettings
.
Note that this value does not have support for SSL/TLS. If you need to
make any https connections, please use the http-client-tls package, which
provides a tlsManagerSettings
value.
Since 0.1.0
type BodyReader = IO ByteString Source #
An IO
action that represents an incoming response body coming from the
server. Data provided by this action has already been gunzipped and
de-chunked, and respects any content-length headers present.
The action gets a single chunk of data from the response body, or an empty bytestring if no more data is available.
Since 0.4.0
brRead :: BodyReader -> IO ByteString Source #
Get a single chunk of data from the response body, or an empty bytestring if no more data is available.
Note that in order to consume the entire request body, you will need to
repeatedly call this function until you receive an empty ByteString
as a
result.
Since 0.1.0
brConsume :: BodyReader -> IO [ByteString] Source #
Strictly consume all remaining chunks of data from the stream.
Since 0.1.0
data HttpException Source #
An exception which may be generated by this library
Since: http-client-0.5.0
HttpExceptionRequest Request HttpExceptionContent | Most exceptions are specific to a Since: http-client-0.5.0 |
InvalidUrlException String String | A URL (first field) is invalid for a given reason (second argument). Since: http-client-0.5.0 |
Instances
Exception HttpException | |
Defined in Network.HTTP.Client.Types | |
Show HttpException | |
Defined in Network.HTTP.Client.Types showsPrec :: Int -> HttpException -> ShowS # show :: HttpException -> String # showList :: [HttpException] -> ShowS # |