diff options
Diffstat (limited to 'Web/Response.hs')
| -rw-r--r-- | Web/Response.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Web/Response.hs b/Web/Response.hs index b08efb9..39f6887 100644 --- a/Web/Response.hs +++ b/Web/Response.hs @@ -1,17 +1,20 @@ module Web.Response where +import qualified Data.Text as T +import Data.Text (Text) + data Response - = HtmlResponse Int String -- Код возврата, содержимое HTML - | TextResponse Int String String -- Код возврата, Content-Type, содержимое HTML + = HtmlResponse Int Text -- Код возврата, содержимое HTML + | TextResponse Int Text Text -- Код возврата, Content-Type, содержимое HTML deriving Show -notFoundResponse = HtmlResponse 404 "<strong>404 Not Found</strong>" +notFoundResponse = HtmlResponse 404 (T.pack "<strong>404 Not Found</strong>") getStatusCode (HtmlResponse code _) = code getStatusCode (TextResponse code _ _) = code -getContentType (HtmlResponse _ _) = "text/html" +getContentType (HtmlResponse _ _) = (T.pack "text/html") getContentType (TextResponse _ contentType _) = contentType getContent (HtmlResponse _ content) = content -getContent (TextResponse _ _ content) = content
\ No newline at end of file +getContent (TextResponse _ _ content) = content |