packages feed

http-types 0.7.1 → 0.7.2

raw patch · 4 files changed

+76/−39 lines, 4 filesdep −HUnitdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependencies removed: HUnit

Dependency ranges changed: hspec

API changes (from Hackage documentation)

+ Network.HTTP.Types: statusIsClientError :: Status -> Bool
+ Network.HTTP.Types: statusIsInformational :: Status -> Bool
+ Network.HTTP.Types: statusIsRedirection :: Status -> Bool
+ Network.HTTP.Types: statusIsServerError :: Status -> Bool
+ Network.HTTP.Types: statusIsSuccessful :: Status -> Bool
+ Network.HTTP.Types.Status: statusIsClientError :: Status -> Bool
+ Network.HTTP.Types.Status: statusIsInformational :: Status -> Bool
+ Network.HTTP.Types.Status: statusIsRedirection :: Status -> Bool
+ Network.HTTP.Types.Status: statusIsServerError :: Status -> Bool
+ Network.HTTP.Types.Status: statusIsSuccessful :: Status -> Bool

Files

Network/HTTP/Types.hs view
@@ -106,6 +106,11 @@ , gatewayTimeout504 , status505 , httpVersionNotSupported505+, statusIsInformational+, statusIsSuccessful+, statusIsRedirection+, statusIsClientError+, statusIsServerError   -- * Headers   -- ** Types , Header@@ -193,5 +198,3 @@ -- | Type synonym for ASCII ByteStrings (deprecated). type Ascii = B.ByteString {-# DEPRECATED Ascii "Deprecated Ascii type" #-}--
Network/HTTP/Types/Status.hs view
@@ -84,6 +84,11 @@ , gatewayTimeout504 , status505 , httpVersionNotSupported505+, statusIsInformational+, statusIsSuccessful+, statusIsRedirection+, statusIsClientError+, statusIsServerError ) where @@ -435,3 +440,23 @@ -- | HTTP Version Not Supported 505 httpVersionNotSupported505 :: Status httpVersionNotSupported505 = status505++-- | Informational class+statusIsInformational :: Status -> Bool+statusIsInformational (Status {statusCode=code}) = code >= 100 && code < 200++-- | Successful class+statusIsSuccessful :: Status -> Bool+statusIsSuccessful (Status {statusCode=code}) = code >= 200 && code < 300++-- | Redirection class+statusIsRedirection :: Status -> Bool+statusIsRedirection (Status {statusCode=code}) = code >= 300 && code < 400++-- | Client Error class+statusIsClientError :: Status -> Bool+statusIsClientError (Status {statusCode=code}) = code >= 400 && code < 500++-- | Server Error class+statusIsServerError :: Status -> Bool+statusIsServerError (Status {statusCode=code}) = code >= 500 && code < 600
http-types.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version:             0.7.1+Version:             0.7.2  -- A short (one-line) description of the package. Synopsis:            Generic HTTP types for Haskell (for both client and server code).@@ -45,6 +45,15 @@ -- Constraint on the version of Cabal needed to build this package. Cabal-version:       >=1.8 +Source-repository this+  type: git+  location: https://github.com/aristidb/aws.git+  tag: 0.7.2++Source-repository head+  type: git+  location: https://github.com/aristidb/aws.git+ Library   -- Modules exported by the library.   Exposed-modules:     Network.HTTP.Types@@ -76,4 +85,4 @@ Test-suite runtests     main-is:           runtests.hs     type:              exitcode-stdio-1.0-    build-depends:     text, bytestring, base, blaze-builder, array, case-insensitive, QuickCheck, HUnit, hspec >= 1.2+    build-depends:     text, bytestring, base, blaze-builder, array, case-insensitive, QuickCheck, hspec >= 1.3
runtests.hs view
@@ -1,49 +1,49 @@-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-orphans #-} import           Data.Text                (Text) import           Debug.Trace import           Network.HTTP.Types-import           Test.Hspec.Core-import           Test.Hspec.QuickCheck-import           Test.Hspec.HUnit-import           Test.QuickCheck          (Arbitrary (..))-import           Test.HUnit+import           Test.Hspec+import           Test.QuickCheck import qualified Blaze.ByteString.Builder as Blaze import qualified Data.ByteString          as S import qualified Data.ByteString.Char8    as S8 import qualified Data.Text                as T  main :: IO ()-main = hspec-    [ describe "encode/decode path"-        [ it "is identity to encode and then decode"-            $ property propEncodeDecodePath-        , it "does not escape period and dash" $-            Blaze.toByteString (encodePath ["foo-bar.baz"] []) @?= "/foo-bar.baz"-        ]-    , describe "encode/decode query"-        [ it "is identity to encode and then decode"-            $ property propEncodeDecodeQuery-        , it "add ? in front of Query if and only if necessary"-            $ property propQueryQuestionMark-        ]-    , describe "encode/decode path segments"-        [ it "is identity to encode and then decode"-            $ property propEncodeDecodePathSegments-        ]-    , describe "encode ByteRanges"-        [ it "first 500 bytes" $ renderByteRanges [ByteRangeFromTo 0 499] @?= "bytes=0-499"-        , it "second 500 bytes" $ renderByteRanges [ByteRangeFromTo 500 999] @?= "bytes=500-999"-        , it "final 500 bytes" $ renderByteRanges [ByteRangeSuffix 500] @?= "bytes=-500"-        , it "final 500 bytes (of 1000, absolute)" $ renderByteRanges [ByteRangeFrom 9500] @?= "bytes=9500-"-        , it "first and last bytes only" $ renderByteRanges [ByteRangeFromTo 0 0, ByteRangeSuffix 1] @?= "bytes=0-0,-1"-        , it "non-canonical second 500 bytes (1)" $ renderByteRanges [ByteRangeFromTo 500 600, ByteRangeFromTo 601 999] @?= "bytes=500-600,601-999"-        , it "non-canonical second 500 bytes (2)" $ renderByteRanges [ByteRangeFromTo 500 700, ByteRangeFromTo 601 999] @?= "bytes=500-700,601-999"          -        ]-    ]+main = hspec $ do+    describe "encode/decode path" $ do+      it "is identity to encode and then decode" $+        property propEncodeDecodePath+      it "does not escape period and dash" $+        Blaze.toByteString (encodePath ["foo-bar.baz"] []) `shouldBe` "/foo-bar.baz" +    describe "encode/decode query" $ do+      it "is identity to encode and then decode" $+        property propEncodeDecodeQuery+      it "add ? in front of Query if and only if necessary" $+        property propQueryQuestionMark++    describe "encode/decode path segments" $ do+      it "is identity to encode and then decode" $+        property propEncodeDecodePathSegments++    describe "encode ByteRanges" $ do+      it "first 500 bytes" $+        renderByteRanges [ByteRangeFromTo 0 499] `shouldBe` "bytes=0-499"+      it "second 500 bytes" $+        renderByteRanges [ByteRangeFromTo 500 999] `shouldBe` "bytes=500-999"+      it "final 500 bytes" $+        renderByteRanges [ByteRangeSuffix 500] `shouldBe` "bytes=-500"+      it "final 500 bytes (of 1000, absolute)" $+        renderByteRanges [ByteRangeFrom 9500] `shouldBe` "bytes=9500-"+      it "first and last bytes only" $+        renderByteRanges [ByteRangeFromTo 0 0, ByteRangeSuffix 1] `shouldBe` "bytes=0-0,-1"+      it "non-canonical second 500 bytes (1)" $+        renderByteRanges [ByteRangeFromTo 500 600, ByteRangeFromTo 601 999] `shouldBe` "bytes=500-600,601-999"+      it "non-canonical second 500 bytes (2)" $+        renderByteRanges [ByteRangeFromTo 500 700, ByteRangeFromTo 601 999] `shouldBe` "bytes=500-700,601-999"+ propEncodeDecodePath :: ([Text], Query) -> Bool propEncodeDecodePath (p', q') =     let x = Blaze.toByteString $ encodePath a b@@ -71,7 +71,7 @@                    (False, _)    -> False                    (True, True)  -> False                    (True, False) -> True-          + propEncodeDecodePathSegments :: [Text] -> Bool propEncodeDecodePathSegments p' =     p == decodePathSegments (Blaze.toByteString $ encodePathSegments p)