hack-2009.4.22: src/Hack/Contrib/ContentType.hs
module Hack.Contrib.ContentType where
import Hack
import Hack.Utils
import Prelude hiding ((.), (^), (>))
import MPS
content_type :: String -> MiddleWare
content_type s app = \env -> do
response <- app env
case response.headers
.filter (fst > is "Content-Type")
.reject (snd > empty) of
[] -> response
{ headers = response.headers ++ [("Content-Type", s)] }
.return
otherwise -> response .return