@@ -25,24 +25,26 @@ debug = debugDest $ hPutStrLn stderr . T.unpack
2525debugDest :: (T.Text -> IO ()) -> Middleware
2626debugDest cb app req = do
2727 body <- consume
28− params <- if any (requestMethod req ==) ["GET", "HEAD"]
29− then return $ map emptyGetParam $ queryString req
28+ postParams <- if any (requestMethod req ==) ["GET", "HEAD"]
29+ then return []
3030 else do postParams <- liftIO $ allPostParams req body
3131 return $ collectPostParams postParams
32− let paramS = if null params then "" else "\n" ++ (show params)
32+ let getParams = map emptyGetParam $ queryString req
3333
3434 liftIO $ cb $ T.pack $ concat
3535 [ unpack $ requestMethod req
3636 , " "
3737 , unpack $ rawPathInfo req
38− , unpack $ rawQueryString req
3938 , "\n"
4039 , (++) "Accept: " $ maybe "" unpack $ lookup "Accept" $ requestHeaders req
41− , paramS
40+ , paramsToStr "GET " getParams
41+ , paramsToStr "POST " postParams
4242 ]
4343 -- we just consumed the body- fill the enumerator back up so it is available again
4444 liftIO $ run_ $ enumList 1 body $$ app req
4545 where
46+ paramsToStr prefix params = if null params then "" else "\n" ++ prefix ++ (show params)
47+
4648 allPostParams req body = run_ $ enumList 1 body $$ parseRequestBody lbsSink req
4749
4850 emptyGetParam :: (S.ByteString, Maybe S.ByteString) -> (S.ByteString, S.ByteString)