packages feed

http-conduit 2.2.3.1 → 2.2.3.2

raw patch · 5 files changed

+14/−22 lines, 5 files

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.2.3.2++* Add proper headers for `httpJSON` and `httpJSONEither` [#284](https://github.com/snoyberg/http-client/issues/284)+ ## 2.2.3.1  * Minor README improvement
Network/HTTP/Conduit.hs view
@@ -87,7 +87,7 @@ -- >                 , cookie_http_only = False -- >                 } -- >--- > main = withSocketsDo $ do+-- > main = do -- >      request' <- parseRequest "http://example.com/secret-page" -- >      manager <- newManager tlsManagerSettings -- >      let request = request' { cookieJar = Just $ createCookieJar [cookie] }@@ -99,19 +99,6 @@ -- >                        else return Nothing -- >                  _ -> E.throw ex) ----- Any network code on Windows requires some initialization, and the network--- library provides withSocketsDo to perform it. Therefore, proper usage of--- this library will always involve calling that function at some point.  The--- best approach is to simply call them at the beginning of your main function,--- such as:------ > import Network.HTTP.Conduit--- > import qualified Data.ByteString.Lazy as L--- > import Network (withSocketsDo)--- >--- > main = withSocketsDo--- >      $ simpleHttp "http://www.haskell.org/" >>= L.putStr--- -- Cookies are implemented according to RFC 6265. -- -- Note that by default, the functions in this package will throw exceptions@@ -124,7 +111,7 @@ -- > import Network -- > -- > main :: IO ()--- > main = withSocketsDo $ do+-- > main = do -- >      request' <- parseRequest "http://www.yesodweb.com/does-not-exist" -- >      let request = request' { checkStatus = \_ _ _ -> Nothing } -- >      manager <- newManager tlsManagerSettings
Network/HTTP/Simple.hs view
@@ -15,6 +15,8 @@ -- > -- > main :: IO () -- > main = httpLBS "http://example.com" >>= L8.putStrLn+--+-- The `Data.String.IsString` instance uses `H.parseRequest` behind the scenes and inherits its behavior. module Network.HTTP.Simple     ( -- * Perform requests       httpLBS@@ -123,17 +125,17 @@ httpJSONEither :: (MonadIO m, FromJSON a)                => H.Request                -> m (H.Response (Either JSONException a))-httpJSONEither req =-    liftIO $ httpSink req sink+httpJSONEither req = liftIO $ httpSink req' sink   where+    req' = addRequestHeader H.hAccept "application/json" req     sink orig = fmap (\x -> fmap (const x) orig) $ do         eres1 <- C.sinkParserEither json'         case eres1 of-            Left e -> return $ Left $ JSONParseException req orig e+            Left e -> return $ Left $ JSONParseException req' orig e             Right value ->                 case A.fromJSON value of                     A.Error e -> return $ Left $ JSONConversionException-                        req (fmap (const value) orig) e+                        req' (fmap (const value) orig) e                     A.Success x -> return $ Right x  -- | An exception that can occur when parsing JSON
http-conduit.cabal view
@@ -1,5 +1,5 @@ name:            http-conduit-version:         2.2.3.1+version:         2.2.3.2 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>
test/main.hs view
@@ -20,7 +20,6 @@ import Control.Exception.Lifted (try, SomeException, bracket, onException, IOException) import qualified Data.IORef as I import qualified Control.Exception as E (catch)-import Network (withSocketsDo) import Network.Socket (sClose) import qualified Network.BSD import CookieTest (cookieTest)@@ -172,7 +171,7 @@         sendResponse res  main :: IO ()-main = withSocketsDo $ do+main = do   mapM_ (`hSetBuffering` LineBuffering) [stdout, stderr]   hspec $ do     cookieTest