-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.hs
More file actions
19 lines (17 loc) · 674 Bytes
/
test.hs
File metadata and controls
19 lines (17 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE OverloadedStrings #-}
import Network.Wai
import Network.Wai.Handler.FastCGI
import Control.Monad.IO.Class
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Lazy.Char8 as L8
import qualified Data.Enumerator as E
main = run app
app req
| pathInfo req == "/" = return $ responseLBS status200 [("Content-Type", "text/html")] "<form method='post' action='/post'><input type='text' name='name'><input type='submit'></form>"
app req = do
bss <- E.consume
return $ responseLBS status200 [("Content-Type", "text/plain")] $ L.concat
[ L8.pack $ show $ requestHeaders req
, "\n"
, L.fromChunks bss
]