Skip to content

Instantly share code, notes, and snippets.

@gregorycollins
Created July 9, 2010 19:27
Show Gist options
  • Save gregorycollins/469919 to your computer and use it in GitHub Desktop.
Save gregorycollins/469919 to your computer and use it in GitHub Desktop.
<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>
{-# 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