salvia-0.0.4: src/Network/Salvia/Handlers/Printer.hs
module Network.Salvia.Handlers.Printer (hPrinter) where
import Control.Monad.State
import Network.Salvia.Httpd
{- |
The 'hPrinter' handler print the entire response including the headers to the
client. This handler is generally used as (one of) the last handler in a
configuration.
-}
hPrinter :: Handler ()
hPrinter = do
-- Send the entire HTTP response header.
sendHeaders
-- Process all send actions in queue.
s <- gets sock
q <- gets queue
lift $ mapM_ ($ s) q