hack-contrib-2009.4.51: src/Hack/Contrib/Middleware/Inspect.hs
module Hack.Contrib.Middleware.Inspect (inspect) where
import Hack
import Hack.Contrib.Constants
import Hack.Contrib.Response
import MPSUTF8
import Prelude hiding ((.), (^), (>), head)
inspect :: Middleware
inspect app = \env -> do
r <- app env
return $
r
.set_body (output env r)
.set_content_type _TextPlainUTF8
where
output env r =
[ env.show
, 70.times '-'
, r.status.show
, r.headers.show
, r.body
] .join "\n\n"