packages feed

hack-2009.4.29: src/Hack/Contrib/ContentType.hs

module Hack.Contrib.ContentType (content_type) where

import Hack
import Hack.Response
import Hack.Constants

import MPSUTF8
import Prelude hiding ((.), (^), (>))


content_type :: String -> MiddleWare
content_type s app = \env -> do
  response <- app env
  
  case response.header _ContentType of
    Nothing -> response.set_header _ContentType s .return
    Just _ -> response .return