wai-extra 1.3.4.2 → 1.3.4.3
raw patch · 3 files changed
+18/−17 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Network/Wai/Middleware/Jsonp.hs +1/−1
- test/sample.hs +16/−15
- wai-extra.cabal +1/−1
Network/Wai/Middleware/Jsonp.hs view
@@ -31,7 +31,7 @@ -- -- Basically, if the user requested a \"text\/javascript\" and supplied a -- \"callback\" GET parameter, ask the application for an--- \"application/json\" response, then convern that into a JSONP response,+-- \"application/json\" response, then convert that into a JSONP response, -- having a content type of \"text\/javascript\" and calling the specified -- callback function. jsonp :: Middleware
test/sample.hs view
@@ -1,25 +1,26 @@-import Data.ByteString.Char8 (unpack, pack)+{-# LANGUAGE OverloadedStrings #-}++import Data.ByteString.Char8 (pack) import Data.ByteString.Lazy (fromChunks)+import Data.Text ()+import Network.HTTP.Types import Network.Wai-import Network.Wai.Enumerator import Network.Wai.Middleware.Gzip import Network.Wai.Middleware.Jsonp-import Network.Wai.Middleware.CleanPath-import Network.Wai.Handler.SimpleServer+import Network.Wai.Handler.Warp -app :: [String] -> Application-app [] _ = return $ Response Status200 [] $ Right $ fromLBS- $ fromChunks $ flip map [1..10000] $ \i -> pack $- concat+app :: Application+app request = return $ case pathInfo request of+ [] -> responseLBS status200 []+ $ fromChunks $ flip map [1..10000] $ \i -> pack $ concat [ "<p>Just this same paragraph again. "- , show i+ , show (i :: Int) , "</p>" ]-app ["test.html"] _ = return $ Response Status200 [] $ Left "test.html"-app ["json"] _ =return $ Response Status200- [(ContentType, pack "application/json")]- $ Left "json"-app _ _ = return $ Response Status404 [] $ Left "../LICENSE"+ ["test.html"] -> ResponseFile status200 [] "test.html" Nothing+ ["json"] -> ResponseFile status200 [(hContentType, "application/json")]+ "json" Nothing+ _ -> ResponseFile status404 [] "../LICENSE" Nothing main :: IO ()-main = run 3000 $ jsonp $ gzip $ cleanPath app+main = run 3000 $ gzip def $ jsonp app
wai-extra.cabal view
@@ -1,5 +1,5 @@ Name: wai-extra-Version: 1.3.4.2+Version: 1.3.4.3 Synopsis: Provides some basic WAI handlers and middleware. Description: The goal here is to provide common features without many dependencies. License: MIT