http-common 0.7.2.0 → 0.8.2.0
raw patch · 4 files changed
+29/−14 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.Http.Types: buildRequest1 :: RequestBuilder α -> Request
- Network.Http.Types: buildRequest :: RequestBuilder α -> IO Request
+ Network.Http.Types: buildRequest :: Monad ν => RequestBuilder α -> ν Request
Files
- http-common.cabal +2/−2
- lib/Network/Http/Internal.hs +1/−1
- lib/Network/Http/RequestBuilder.hs +24/−10
- lib/Network/Http/Types.hs +2/−1
http-common.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: http-common-version: 0.7.2.0+version: 0.8.2.0 synopsis: Common types for HTTP clients and servers description: /Overview/@@ -14,7 +14,7 @@ license-file: LICENCE author: Andrew Cowie <andrew@operationaldynamics.com> maintainer: Andrew Cowie <andrew@operationaldynamics.com>-copyright: © 2012-2014 Operational Dynamics Consulting, Pty Ltd and Others+copyright: © 2012-2015 Operational Dynamics Consulting, Pty Ltd and Others category: Web tested-with: GHC == 7.8 stability: experimental
lib/Network/Http/Internal.hs view
@@ -1,7 +1,7 @@ -- -- HTTP types for use with io-streams and pipes ----- Copyright © 2012-2013 Operational Dynamics Consulting, Pty Ltd+-- Copyright © 2012-2014 Operational Dynamics Consulting, Pty Ltd -- -- The code in this file, and the program it is a part of, is -- made available to you by its authors as open source software:
lib/Network/Http/RequestBuilder.hs view
@@ -1,7 +1,7 @@ -- -- HTTP types for use with io-streams and pipes ----- Copyright © 2012-2013 Operational Dynamics Consulting, Pty Ltd+-- Copyright © 2012-2014 Operational Dynamics Consulting, Pty Ltd and Others -- -- The code in this file, and the program it is a part of, is -- made available to you by its authors as open source software:@@ -16,6 +16,7 @@ module Network.Http.RequestBuilder ( RequestBuilder, buildRequest,+ buildRequest1, http, setHostname, setAccept,@@ -57,17 +58,17 @@ -- | Run a RequestBuilder, yielding a Request object you can use on the -- given connection. ----- > q <- buildRequest $ do--- > http POST "/api/v1/messages"--- > setContentType "application/json"--- > setHostname "clue.example.com" 80--- > setAccept "text/html"--- > setHeader "X-WhoDoneIt" "The Butler"+-- > let q = buildRequest1 $ do+-- > http POST "/api/v1/messages"+-- > setContentType "application/json"+-- > setHostname "clue.example.com" 80+-- > setAccept "text/html"+-- > setHeader "X-WhoDoneIt" "The Butler" -- -- Obviously it's up to you to later actually /send/ JSON data. ---buildRequest :: RequestBuilder α -> IO Request-buildRequest mm = do+buildRequest1 :: RequestBuilder α -> Request+buildRequest1 mm = do let (RequestBuilder s) = (mm) let q = Request { qHost = Nothing,@@ -77,8 +78,21 @@ qExpect = Normal, qHeaders = emptyHeaders }- return $ execState s q+ execState s q +--+-- | Run a RequestBuilder from within a monadic action.+--+-- Older versions of this library had 'buildRequest' in IO; there's+-- no longer a need for that, but this code path will continue to+-- work for existing users.+--+-- > q <- buildRequest $ do+-- > http GET "/"+--+buildRequest :: Monad ν => RequestBuilder α -> ν Request+buildRequest = return . buildRequest1+{-# INLINE buildRequest #-} -- -- | Begin constructing a Request, starting with the request line.
lib/Network/Http/Types.hs view
@@ -1,7 +1,7 @@ -- -- HTTP types for use with io-streams and pipes ----- Copyright © 2012-2013 Operational Dynamics Consulting, Pty Ltd+-- Copyright © 2012-2014 Operational Dynamics Consulting, Pty Ltd -- -- The code in this file, and the program it is a part of, is -- made available to you by its authors as open source software:@@ -28,6 +28,7 @@ RequestBuilder, buildRequest,+ buildRequest1, http, setHostname, setAccept,