This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-server".

The branch, master has been updated
       via  e33282b149be786b099cd2263c32756d61e19b9c (commit)
      from  12903833b3a130b1eba1ef1fd512e7bc3feb0df4 (commit)


Summary of changes:
 test/testserver/Main.hs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e33282b149be786b099cd2263c32756d61e19b9c
Author: Gregory Collins <[email protected]>
Date:   Thu Sep 2 15:09:25 2010 -0400

    Add code to echo response body to the testserver

diff --git a/test/testserver/Main.hs b/test/testserver/Main.hs
index d29f8b3..354a78e 100644
--- a/test/testserver/Main.hs
+++ b/test/testserver/Main.hs
@@ -1,9 +1,11 @@
 {-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RankNTypes #-}
+
 module Main where
 
 import           Control.Concurrent
 
-import           Snap.Iteratee
+import           Snap.Iteratee hiding (Enumerator)
 import           Snap.Types
 import           Snap.Http.Server
 import           Snap.Util.FileServe
@@ -23,11 +25,19 @@ pongHandler = modifyResponse $ setResponseBody (enumBS 
"PONG") .
                               setContentType "text/plain" .
                               setContentLength 4
 
-echoHandler :: Snap ()
-echoHandler = do
+echoUriHandler :: Snap ()
+echoUriHandler = do
     req <- getRequest
     writeBS $ rqPathInfo req
 
+
+echoHandler :: Snap ()
+echoHandler = do
+    unsafeDetachRequestBody >>= \e -> do
+      let (SomeEnumerator x) = e
+      modifyResponse $ setResponseBody x
+
+
 responseHandler = do
     code <- getParam "code"
     case code of
@@ -37,14 +47,17 @@ responseHandler = do
     f "300" = undefined
     f "304" = undefined
 
+
 handlers :: Snap ()
 handlers =
     route [ ("pong", pongHandler)
           , ("echo", echoHandler)
+          , ("echoUri", echoUriHandler)
           , ("fileserve", fileServe "static")
           , ("respcode/:code", responseHandler)
           ]
 
+
 main :: IO ()
 main = do
     m <- newEmptyMVar
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap-server
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to