module Hack.Contrib.ContentType where

import Hack
import Hack.Utils
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
    otherwise -> response .return