@@ -44,6 +44,7 @@ import Network.Wai.Internal (Response (ResponseRaw))
4444import Data.Default.Class (Default (def))
4545import Network.Wai.Logger
4646import Network.Wai.Middleware.RequestLogger.Internal
47+import Data.Text.Encoding (decodeUtf8')
4748
4849data OutputFormat = Apache IPAddrSource
4950 | Detailed Bool -- ^ use colors?
@@ -222,6 +223,8 @@ detailedMiddleware' cb ansiColor ansiMethod ansiStatusCode app req sendResponse
222223 return (req', body)
223224 _ -> return (req, [])
224225
226+ let reqbodylog _ = if null body then [""] else ansiColor White " Request Body: " <> body <> ["\n"]
227+ reqbody = concatMap (either (const [""]) reqbodylog . decodeUtf8') body
225228 postParams <- if requestMethod req `elem` ["GET", "HEAD"]
226229 then return []
227230 else do postParams <- liftIO $ allPostParams body
@@ -247,7 +250,7 @@ detailedMiddleware' cb ansiColor ansiMethod ansiStatusCode app req sendResponse
247250 -- log the status of the response
248251 cb $ mconcat $ map toLogStr $
249252 ansiMethod (requestMethod req) ++ [" ", rawPathInfo req, "\n"] ++
250− params ++
253+ params ++ reqbody ++
251254 ansiColor White " Accept: " ++ [accept, "\n"] ++
252255 if isRaw then [] else
253256 ansiColor White " Status: " ++