blob: b08efb98f4355c940b4cf0879237abfa18cccd89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
module Web.Response where
data Response
= HtmlResponse Int String -- Код возврата, содержимое HTML
| TextResponse Int String String -- Код возврата, Content-Type, содержимое HTML
deriving Show
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
|