packages feed

servant-http-streams 0.18.3 → 0.18.4

raw patch · 4 files changed

+25/−19 lines, 4 filesdep ~basedep ~base-compatdep ~hspecnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, base-compat, hspec, servant, servant-client-core, servant-server, text, time, transformers-compat

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,6 +1,16 @@   [The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-http-streams/CHANGELOG.md) [Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md) +0.18.4+------++### Significant changes++- *servant-client* / *servant-client-core* / *servant-http-streams*:+  Fix erroneous behavior, where only 2XX status codes would be considered+  successful, irrelevant of the status parameter specified by the verb+  combinator. ([#1469](https://github.com/haskell-servant/servant/pull/1469))+ 0.18.3 ------ 
servant-http-streams.cabal view
@@ -1,6 +1,6 @@-cabal-version:       >=1.10+cabal-version:       2.2 name:                servant-http-streams-version:             0.18.3+version:             0.18.4  synopsis:            Automatic derivation of querying functions for servant category:            Servant, Web@@ -14,13 +14,13 @@  homepage:            http://docs.servant.dev/ bug-reports:         http://github.com/haskell-servant/servant/issues-license:             BSD3+license:             BSD-3-Clause license-file:        LICENSE author:              Servant Contributors maintainer:          haskell-servant-maintainers@googlegroups.com copyright:           2019 Servant Contributors build-type:          Simple-tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1+tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1  extra-source-files:   CHANGELOG.md@@ -54,8 +54,8 @@   -- Servant dependencies.   -- Strict dependency on `servant-client-core` as we re-export things.   build-depends:-      servant               == 0.18.*-    , servant-client-core   >= 0.18.3 && <0.18.4+      servant               >= 0.18 && < 0.20+    , servant-client-core   >= 0.18.3 && <0.20    -- Other dependencies: Lower bound around what is in the latest Stackage LTS.   -- Here can be exceptions if we really need features from the newer versions.@@ -66,7 +66,7 @@     , http-media            >= 0.7.1.3  && < 0.9     , io-streams            >= 1.5.0.1  && < 1.6     , http-types            >= 0.12.2   && < 0.13-    , http-common           >= 0.8.2.0  && < 0.9+    , http-common           >= 0.8.2.0  && < 0.8.3     , exceptions            >= 0.10.0   && < 0.11     , kan-extensions        >= 5.2      && < 5.3     , monad-control         >= 1.0.2.3  && < 1.1@@ -116,8 +116,8 @@     , HUnit             >= 1.6.0.0  && < 1.7     , network           >= 2.8.0.0  && < 3.2     , QuickCheck        >= 2.12.6.1 && < 2.15-    , servant           == 0.18.*-    , servant-server    == 0.18.*+    , servant           == 0.19.*+    , servant-server    == 0.19.*     , tdigest           >= 0.2     && < 0.3    build-tool-depends:
src/Servant/HttpStreams/Internal.hs view
@@ -49,8 +49,6 @@                  (maybeToList) import           Data.Proxy                  (Proxy (..))-import           Data.Semigroup-                 ((<>)) import           Data.Sequence                  (fromList) import           Data.String@@ -59,7 +57,7 @@ import           Network.HTTP.Media                  (renderHeader) import           Network.HTTP.Types-                 (Status (..), hContentType, http11, renderQuery)+                 (Status (..), hContentType, http11, renderQuery, statusIsSuccessful) import           Servant.Client.Core  import qualified Network.Http.Client        as Client@@ -162,12 +160,12 @@     x <- ClientM $ lift $ lift $ Codensity $ \k -> do         Client.sendRequest conn req' body         Client.receiveResponse conn $ \res' body' -> do-            let sc = Client.getStatusCode res'+            let status = toEnum $ Client.getStatusCode res'             lbs <- BSL.fromChunks <$> Streams.toList body'             let res'' = clientResponseToResponse res' lbs                 goodStatus = case acceptStatus of-                  Nothing -> sc >= 200 && sc < 300-                  Just good -> sc `elem` (statusCode <$> good)+                  Nothing -> statusIsSuccessful status+                  Just good -> status `elem` good             if goodStatus             then k (Right res'')             else k (Left (mkFailureResponse burl req res''))@@ -182,8 +180,8 @@         Client.sendRequest conn req' body         Client.receiveResponseRaw conn $ \res' body' -> do             -- check status code-            let sc = Client.getStatusCode res'-            unless (sc >= 200 && sc < 300) $ do+            let status = toEnum $ Client.getStatusCode res'+            unless (statusIsSuccessful status) $ do                 lbs <- BSL.fromChunks <$> Streams.toList body'                 throwIO $ mkFailureResponse burl req (clientResponseToResponse res' lbs) 
test/Servant/ClientSpec.hs view
@@ -44,8 +44,6 @@                  (isJust) import           Data.Monoid () import           Data.Proxy-import           Data.Semigroup-                 ((<>)) import           GHC.Generics                  (Generic) import qualified Network.HTTP.Types                   as HTTP