module Network.Salvia.Handlers.Printer (hPrinter) where import Control.Monad.State import Data.Record.Label (getM) 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 <- getM sock q <- getM queue lift $ mapM_ ($ s) q