on master help sign in
Added sample file for gzip testing
commitb3da12c1a4e8ba1710be65e50fcceca0e06dbf1f authorMichael Snoyman <michael@snoyman.com> dateSat 15 May 2010, 23:17 (16 years ago) parent9de5f03
1 file changed+21
test/sample.hs+21
test/sample.hsnew file+21
@@ -0,0 +1,21 @@
1+import Data.ByteString.Char8 (unpack, pack)
2+import Data.ByteString.Lazy (fromChunks)
3+import Network.Wai
4+import Network.Wai.Enumerator
5+import Network.Wai.Middleware.Gzip
6+import Network.Wai.Handler.SimpleServer
7+
8+app :: Application
9+app req =
10+ case unpack $ pathInfo req of
11+ "/" -> return $ Response Status200 [] $ Right $ fromLBS
12+ $ fromChunks $ flip map [1..10000] $ \i -> pack $
13+ concat
14+ [ "<p>Just this same paragraph again. "
15+ , show i
16+ , "</p>"
17+ ]
18+ _ -> return $ Response Status404 [] $ Left "../LICENSE"
19+
20+main :: IO ()
21+main = run 3000 $ gzip app