on master help sign in
Fix warp pong
commit61081b2c03f1419c0d674bbd7f6ce69a36838988 authorMichael Snoyman <michael@snoyman.com> dateMon 4 Aug 2014, 07:09 (12 years ago) parentfd8989f
1 file changed+12−12
warp/attic/pong.hs+12−12
warp/attic/pong.hs+12−12
@@ -9,7 +9,7 @@ import qualified Data.Conduit.List as CL
99
1010main = run 3000 app
1111
12−app req = return $
12+app req = ($
1313 case rawPathInfo req of
1414 "/builder/withlen" -> builderWithLen
1515 "/builder/nolen" -> builderNoLen
@@ -17,36 +17,36 @@ app req = return $
1717 "/file/nolen" -> fileNoLen
1818 "/source/withlen" -> sourceWithLen
1919 "/source/nolen" -> sourceNoLen
20− "/notfound" -> ResponseFile status200 [] "notfound" Nothing
21− x -> index x
20+ "/notfound" -> responseFile status200 [] "notfound" Nothing
21+ x -> index x)
2222
23−builderWithLen = ResponseBuilder
23+builderWithLen = responseBuilder
2424 status200
2525 [ ("Content-Type", "text/plain")
2626 , ("Content-Length", "4")
2727 ]
2828 $ copyByteString "PONG"
2929
30−builderNoLen = ResponseBuilder
30+builderNoLen = responseBuilder
3131 status200
3232 [ ("Content-Type", "text/plain")
3333 ]
3434 $ copyByteString "PONG"
3535
36−sourceWithLen = ResponseSource
36+sourceWithLen = responseStream
3737 status200
3838 [ ("Content-Type", "text/plain")
3939 , ("Content-Length", "4")
4040 ]
41− $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
41+ $ \send _ -> send $ copyByteString "PONG"
4242
43−sourceNoLen = ResponseSource
43+sourceNoLen = responseStream
4444 status200
4545 [ ("Content-Type", "text/plain")
4646 ]
47− $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
47+ $ \send _ -> send $ copyByteString "PONG"
4848
49−fileWithLen = ResponseFile
49+fileWithLen = responseFile
5050 status200
5151 [ ("Content-Type", "text/plain")
5252 , ("Content-Length", "4")
@@ -54,14 +54,14 @@ fileWithLen = ResponseFile
5454 "pong.txt"
5555 Nothing
5656
57−fileNoLen = ResponseFile
57+fileNoLen = responseFile
5858 status200
5959 [ ("Content-Type", "text/plain")
6060 ]
6161 "pong.txt"
6262 Nothing
6363
64−index p = ResponseBuilder status200 [("Content-Type", "text/html")] $ mconcat $ map copyByteString
64+index p = responseBuilder status200 [("Content-Type", "text/html")] $ mconcat $ map copyByteString
6565 [ "<p><a href='/builder/withlen'>builder withlen</a></p>\n"
6666 , "<p><a href='/builder/nolen'>builder nolen</a></p>\n"
6767 , "<p><a href='/file/withlen'>file withlen</a></p>\n"