http-conduit 2.2.3.2 → 2.2.4
raw patch · 3 files changed
+23/−8 lines, 3 files
Files
- ChangeLog.md +4/−0
- Network/HTTP/Simple.hs +18/−7
- http-conduit.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.2.4++* Add `httpBS` to `Network.HTTP.Simple`+ ## 2.2.3.2 * Add proper headers for `httpJSON` and `httpJSONEither` [#284](https://github.com/snoyberg/http-client/issues/284)
Network/HTTP/Simple.hs view
@@ -11,15 +11,16 @@ -- -- > {-# LANGUAGE OverloadedStrings #-} -- > import Network.HTTP.Simple--- > import qualified Data.ByteString.Lazy.Char8 as L8+-- > import qualified Data.ByteString.Char8 as B8 -- > -- > main :: IO ()--- > main = httpLBS "http://example.com" >>= L8.putStrLn+-- > main = httpBS "http://example.com" >>= B8.putStrLn . getResponseBody -- -- The `Data.String.IsString` instance uses `H.parseRequest` behind the scenes and inherits its behavior. module Network.HTTP.Simple ( -- * Perform requests- httpLBS+ httpBS+ , httpLBS , httpNoBody , httpJSON , httpJSONEither@@ -93,10 +94,20 @@ import Data.Int (Int64) import Control.Monad.Trans.Resource (MonadResource) --- | Perform an HTTP request and return the body as a lazy @ByteString@. Note--- that the entire value will be read into memory at once (no lazy I\/O will be--- performed).+-- | Perform an HTTP request and return the body as a @ByteString@. --+-- @since 2.2.4+httpBS :: MonadIO m => H.Request -> m (H.Response S.ByteString)+httpBS req = liftIO $ do+ man <- H.getGlobalManager+ fmap L.toStrict `fmap` H.httpLbs req man++-- | Perform an HTTP request and return the body as a lazy+-- @ByteString@. Note that the entire value will be read into memory+-- at once (no lazy I\/O will be performed). The advantage of a lazy+-- @ByteString@ here (versus using 'httpBS') is--if needed--a better+-- in-memory representation.+-- -- @since 2.1.10 httpLBS :: MonadIO m => H.Request -> m (H.Response L.ByteString) httpLBS req = liftIO $ do@@ -317,7 +328,7 @@ -- /Note/: This will not modify the request method. For that, please use -- 'requestMethod'. You likely don't want the default of @GET@. ----- This also sets the @content-type@ to @application/json; chatset=utf8@+-- This also sets the @Content-Type@ to @application/json; charset=utf-8@ -- -- @since 2.1.10 setRequestBodyJSON :: A.ToJSON a => a -> H.Request -> H.Request
http-conduit.cabal view
@@ -1,5 +1,5 @@ name: http-conduit-version: 2.2.3.2+version: 2.2.4 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>