summaryrefslogtreecommitdiff
path: root/Response.hs
blob: 7b990053af8fabc6b55a2fc8424ea1a6d20fb045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Response where

data Response =
  HtmlResponse Int String -- Код возврата, содержимое HTML
  | TextResponse Int String String -- Код возврата, Content-Type, содержимое HTML

notFoundResponse = HtmlResponse 404 "<strong>404 Not Found</strong>"

getStatusCode (HtmlResponse code _) = code
getStatusCode (TextResponse code _ _) = code

getContentType (HtmlResponse _ _) = "text/html"
getContentType (TextResponse _ contentType _) = contentType

getContent (HtmlResponse _ content) = content
getContent (TextResponse _ _ content) = content