diff options
author | Clint Adams <clint@debian.org> | 2017-07-06 21:47:12 -0400 |
---|---|---|
committer | Clint Adams <clint@debian.org> | 2017-07-06 21:51:00 -0400 |
commit | 83b49d9077272e7a2eb9acd16a9e8c21fae75229 (patch) | |
tree | b7c07b040057954293832560918a7ced5de67299 /p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff | |
parent | 4176ef48408ac21f2d898cc72c52578e778c16f2 (diff) | |
download | DHG_packages-83b49d9077272e7a2eb9acd16a9e8c21fae75229.tar.gz |
http-client: Upgrading from 0.4.31.2 to 0.5.7.0
Diffstat (limited to 'p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff')
-rw-r--r-- | p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff | 81 |
1 files changed, 58 insertions, 23 deletions
diff --git a/p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff b/p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff index ffd072ae4..0d3aea859 100644 --- a/p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff +++ b/p/haskell-http-client/debian/patches/disable-external-network-connection-test.diff @@ -1,52 +1,87 @@ --- a/test/Network/HTTP/ClientSpec.hs +++ b/test/Network/HTTP/ClientSpec.hs -@@ -12,48 +12,4 @@ +@@ -15,83 +15,4 @@ main = hspec spec spec :: Spec -spec = describe "Client" $ do - it "works" $ withSocketsDo $ do -- req <- parseUrl "http://httpbin.org/" +- req <- parseUrlThrow "http://httpbin.org/" - man <- newManager defaultManagerSettings - res <- httpLbs req man - responseStatus res `shouldBe` status200 - - describe "method in URL" $ do - it "success" $ withSocketsDo $ do -- req <- parseUrl "POST http://httpbin.org/post" +- req <- parseUrlThrow "POST http://httpbin.org/post" - man <- newManager defaultManagerSettings - res <- httpLbs req man - responseStatus res `shouldBe` status200 - - it "failure" $ withSocketsDo $ do -- req' <- parseUrl "PUT http://httpbin.org/post" -- let req = req' -- { checkStatus = \_ _ _ -> Nothing -- } +- req <- parseRequest "PUT http://httpbin.org/post" - man <- newManager defaultManagerSettings - res <- httpLbs req man - responseStatus res `shouldBe` status405 - -- describe "managerModifyRequest" $ do -- -- it "can set port to 80" $ do -- let modify req = return req { port = 80 } -- settings = defaultManagerSettings { managerModifyRequest = modify } -- withManager settings $ \man -> do -- res <- httpLbs "http://httpbin.org:1234" man +- describe "redirects" $ do +- it "follows redirects" $ do +- req <- parseRequest "http://httpbin.org/redirect-to?url=http://httpbin.org" +- man <- newManager defaultManagerSettings +- res <- httpLbs req man - responseStatus res `shouldBe` status200 - -- it "can set 'checkStatus' to throw StatusCodeException" $ do -- let modify req = return req { checkStatus = \s hs cj -> Just $ toException $ StatusCodeException s hs cj } -- settings = defaultManagerSettings { managerModifyRequest = modify } -- withManager settings $ \man -> -- httpLbs "http://httpbin.org" man `shouldThrow` anyException +- it "allows to disable redirect following" $ do +- req <- (\ r -> r{ redirectCount = 0 }) <$> +- parseRequest "http://httpbin.org/redirect-to?url=http://httpbin.org" +- man <- newManager defaultManagerSettings +- res <- httpLbs req man +- responseStatus res `shouldBe` found302 - -- it "can set redirectCount to 0 to prevent following redirects" $ do -- let modify req = return req { redirectCount = 0 } -- settings = defaultManagerSettings { managerModifyRequest = modify } +- context "managerModifyResponse" $ do +- it "allows to modify the response status code" $ do +- let modify :: Response BodyReader -> IO (Response BodyReader) +- modify res = do +- return res { +- responseStatus = (responseStatus res) { +- statusCode = 201 +- } +- } +- settings = defaultManagerSettings { managerModifyResponse = modify } - man <- newManager settings -- httpLbs "http://httpbin.org/redirect-to?url=foo" man `shouldThrow` ( \ (StatusCodeException s _ _) -> s == found302) +- res <- httpLbs "http://httpbin.org" man +- (statusCode.responseStatus) res `shouldBe` 201 - +- it "modifies the response body" $ do +- let modify :: Response BodyReader -> IO (Response BodyReader) +- modify res = do +- reader <- constBodyReader [BS.pack "modified response body"] +- return res { +- responseBody = reader +- } +- settings = defaultManagerSettings { managerModifyResponse = modify } +- man <- newManager settings +- res <- httpLbs "http://httpbin.org" man +- responseBody res `shouldBe` "modified response body" +- +- context "managerModifyRequest" $ do +- it "port" $ do +- let modify req = return req { port = 80 } +- settings = defaultManagerSettings { managerModifyRequest = modify } +- man <- newManager settings +- res <- httpLbs "http://httpbin.org:1234" man +- responseStatus res `shouldBe` status200 +- +- it "checkResponse" $ do +- let modify req = return req { checkResponse = \_ _ -> error "some exception" } +- settings = defaultManagerSettings { managerModifyRequest = modify } +- man <- newManager settings +- httpLbs "http://httpbin.org" man `shouldThrow` anyException - +- it "redirectCount" $ do +- let modify req = return req { redirectCount = 0 } +- settings = defaultManagerSettings { managerModifyRequest = modify } +- man <- newManager settings +- response <- httpLbs "http://httpbin.org/redirect-to?url=foo" man +- responseStatus response `shouldBe` found302 +spec = return () |