wai-extra 1.3.3 → 1.3.3.1
raw patch · 3 files changed
+23/−2 lines, 3 filesdep +containersPVP ok
version bump matches the API change (PVP)
Dependencies added: containers
API changes (from Hackage documentation)
Files
- Network/Wai/Middleware/Gzip.hs +10/−1
- test/WaiExtraTest.hs +11/−0
- wai-extra.cabal +2/−1
Network/Wai/Middleware/Gzip.hs view
@@ -39,6 +39,7 @@ import Data.Conduit.Blaze (builderToByteStringFlush) import Blaze.ByteString.Builder (fromByteString) import Control.Exception (try, SomeException)+import qualified Data.Set as Set data GzipSettings = GzipSettings { gzipFiles :: GzipFiles@@ -52,7 +53,15 @@ def = GzipSettings GzipIgnore defaultCheckMime defaultCheckMime :: S.ByteString -> Bool-defaultCheckMime bs = S8.isPrefixOf "text/" bs || S8.isPrefixOf "application/json" bs+defaultCheckMime bs =+ S8.isPrefixOf "text/" bs || bs' `Set.member` toCompress+ where+ bs' = fst $ S.breakByte 59 bs -- semicolon+ toCompress = Set.fromList+ [ "application/json"+ , "application/javascript"+ , "application/ecmascript"+ ] -- | Use gzip to compress the body of the response. --
test/WaiExtraTest.hs view
@@ -63,6 +63,7 @@ it "jsonp" caseJsonp it "gzip" caseGzip it "gzip not for MSIE" caseGzipMSIE+ it "defaultCheckMime" caseDefaultCheckMime it "vhost" caseVhost it "autohead" caseAutohead it "method override" caseMethodOverride@@ -330,6 +331,16 @@ } assertNoHeader "Content-Encoding" sres2 assertBody "test" sres2++caseDefaultCheckMime :: Assertion+caseDefaultCheckMime = do+ let go x y = (x, defaultCheckMime x) `shouldBe` (x, y)+ go "application/json" True+ go "application/javascript" True+ go "application/something" False+ go "text/something" True+ go "foo/bar" False+ go "application/json; charset=utf-8" True caseGzipMSIE :: Assertion caseGzipMSIE = flip runSession gzipApp $ do
wai-extra.cabal view
@@ -1,5 +1,5 @@ Name: wai-extra-Version: 1.3.3+Version: 1.3.3.1 Synopsis: Provides some basic WAI handlers and middleware. Description: The goal here is to provide common features without many dependencies. License: MIT@@ -43,6 +43,7 @@ , resourcet >= 0.3 && < 0.5 , void >= 0.5 && < 0.6 , stringsearch >= 0.3 && < 0.4+ , containers Exposed-modules: Network.Wai.Handler.CGI Network.Wai.Middleware.AcceptOverride