1{-# LANGUAGE OverloadedStrings #-}
3import Network.Wai.Handler.Warp
4import Network.HTTP.Types (status200)
5import Blaze.ByteString.Builder (copyByteString)
7import qualified Data.Conduit as C
8import qualified Data.Conduit.List as CL
13 case rawPathInfo req of
14 "/builder/withlen" -> builderWithLen
15 "/builder/nolen" -> builderNoLen
16 "/file/withlen" -> fileWithLen
17 "/file/nolen" -> fileNoLen
18 "/source/withlen" -> sourceWithLen
19 "/source/nolen" -> sourceNoLen
20 "/notfound" -> ResponseFile status200 [] "notfound" Nothing
23builderWithLen = ResponseBuilder
25 [ ("Content-Type", "text/plain")
26 , ("Content-Length", "4")
28 $ copyByteString "PONG"
30builderNoLen = ResponseBuilder
32 [ ("Content-Type", "text/plain")
34 $ copyByteString "PONG"
36sourceWithLen = ResponseSource
38 [ ("Content-Type", "text/plain")
39 , ("Content-Length", "4")
41 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
43sourceNoLen = ResponseSource
45 [ ("Content-Type", "text/plain")
47 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
49fileWithLen = ResponseFile
51 [ ("Content-Type", "text/plain")
52 , ("Content-Length", "4")
57fileNoLen = ResponseFile
59 [ ("Content-Type", "text/plain")
64index p = ResponseBuilder status200 [("Content-Type", "text/html")] $ mconcat $ map copyByteString
65 [ "<p><a href='/builder/withlen'>builder withlen</a></p>\n"
66 , "<p><a href='/builder/nolen'>builder nolen</a></p>\n"
67 , "<p><a href='/file/withlen'>file withlen</a></p>\n"
68 , "<p><a href='/file/nolen'>file nolen</a></p>\n"
69 , "<p><a href='/source/withlen'>source withlen</a></p>\n"
70 , "<p><a href='/source/nolen'>source nolen</a></p>\n"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list