Created
July 9, 2010 19:27
-
-
Save gregorycollins/469919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<h1></h1> | |
<form method="POST" action="http://localhost:3000/"> | |
<input name="foo" value="bar" type="hidden"></input> | |
<input type="submit" value="submit"> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Applicative | |
import Control.Monad.Trans | |
import qualified Data.ByteString.Lazy as L | |
import Snap.Http.Server | |
import Snap.Types | |
import Snap.Util.FileServe | |
import Server | |
main = httpServe "*" 3000 "localhost" Nothing Nothing $ do | |
liftIO $ putStrLn "Requesting request body..." | |
reqBody <- getRequestBody | |
liftIO $ print ("Received request body: ", reqBody) | |
modifyResponse $ setContentType "text/html" | |
writeLBS $ "<form method='post'><input name='foo'><input type='submit'></form>" `L.append` reqBody | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment