Skip to content

Commit

Permalink
Merge 93c4602 into a34aaa3
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkkrp committed Jun 20, 2017
2 parents a34aaa3 + 93c4602 commit 750d0cb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
22 changes: 1 addition & 21 deletions Network/HTTP/Req/Conduit.hs
Expand Up @@ -26,7 +26,6 @@ module Network.HTTP.Req.Conduit
ReqBodySource (..)
-- * Streaming response bodies
-- $streaming-response
, req'
, httpSource )
where

Expand Down Expand Up @@ -99,28 +98,9 @@ instance HttpBody ReqBodySource where
-- > main :: IO ()
-- > main = runConduitRes $ do
-- > let size = 100000 :: Int
-- > req' GET (https "httpbin.org" /: "bytes" /~ size) NoReqBody httpSource mempty
-- > req' GET (https "httpbin.org" /: "bytes" /~ size) NoReqBody mempty httpSource
-- > =$= CB.sinkFile "my-favorite-file.bin"

-- | Mostly like 'req' with respect to its arguments, but instead of a hint
-- how to interpret response it takes a callback that allows to perform a
-- request using arbitrary code.

req'
:: ( MonadHttp m
, HttpMethod method
, HttpBody body
, HttpBodyAllowed (AllowsBody method) (ProvidesBody body) )
=> method -- ^ HTTP method
-> Url scheme -- ^ 'Url' — location of resource
-> body -- ^ Body of the request
-> (L.Request -> L.Manager -> m a) -- ^ How to perform the actual request
-> Option scheme -- ^ Collection of optional parameters
-> m a -- ^ Result
req' method url body m options = do
request <- responseRequest `liftM` req method url body returnRequest options
withReqManager (m request)

-- | Perform an HTTP request and get the response as a 'C.Producer'.

httpSource
Expand Down
2 changes: 1 addition & 1 deletion httpbin-tests/Network/HTTP/Req/ConduitSpec.hs
Expand Up @@ -47,7 +47,7 @@ spec = do
let size :: Int
size = 10 * 1024 * 1024
req' GET (httpbin /: "stream-bytes" /~ size) NoReqBody
httpSource mempty =$= CB.sinkHandle h
mempty httpSource =$= CB.sinkHandle h

----------------------------------------------------------------------------
-- Instances
Expand Down
8 changes: 4 additions & 4 deletions req-conduit.cabal
@@ -1,5 +1,5 @@
name: req-conduit
version: 0.1.0
version: 0.2.0
cabal-version: >= 1.10
tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2
license: BSD3
Expand Down Expand Up @@ -29,7 +29,7 @@ library
, bytestring >= 0.2 && < 0.11
, conduit >= 0.5.5 && < 1.3
, http-client >= 0.5 && < 0.6
, req >= 0.1 && < 0.3
, req >= 0.3 && < 0.4
, resourcet >= 1.1 && < 1.2
, transformers >= 0.4 && < 0.6
exposed-modules: Network.HTTP.Req.Conduit
Expand All @@ -49,7 +49,7 @@ test-suite httpbin-tests
, conduit >= 0.5.5 && < 1.3
, conduit-extra >= 1.1.10 && < 1.2
, hspec >= 2.0 && < 3.0
, req >= 0.1 && < 0.3
, req >= 0.3 && < 0.4
, req-conduit
, resourcet >= 1.1 && < 1.2
, temporary >= 1.1 && < 1.3
Expand All @@ -68,7 +68,7 @@ benchmark weigh-bench
, bytestring >= 0.2 && < 0.11
, conduit >= 0.5.5 && < 1.3
, conduit-extra >= 1.1.10 && < 1.2
, req >= 0.1 && < 0.3
, req >= 0.3 && < 0.4
, req-conduit
, resourcet >= 1.1 && < 1.2
, temporary >= 1.1 && < 1.3
Expand Down
2 changes: 2 additions & 0 deletions stack.yaml
@@ -1,3 +1,5 @@
resolver: lts-8.15
packages:
- '.'
extra-deps:
- req-0.3.0

0 comments on commit 750d0cb

Please sign in to comment.