hack-contrib-2009.4.50: src/Hack/Contrib/Middleware/ContentType.hs
module Hack.Contrib.Middleware.ContentType (content_type) where
import Hack
import Hack.Contrib.Response
import Hack.Contrib.Constants
import MPSUTF8
import Prelude hiding ((.), (^), (>))
content_type :: String -> Middleware
content_type s app = \env -> do
response <- app env
return $ case response.header _ContentType of
Nothing -> response.set_header _ContentType s
Just _ -> response