diff options
Diffstat (limited to 'Web/Response.hs')
| -rw-r--r-- | Web/Response.hs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/Web/Response.hs b/Web/Response.hs deleted file mode 100644 index 3c393ad..0000000 --- a/Web/Response.hs +++ /dev/null @@ -1,30 +0,0 @@ -module Web.Response where - -import qualified Data.Text as T -import Data.Text (Text) - -import Web.Utils - -data Response - = HtmlResponse Int Text -- Код возврата, содержимое HTML - | TextResponse Int Text Text -- Код возврата, Content-Type, содержимое HTML - deriving Show - -notFoundResponse = HtmlResponse 404 (T.pack "<strong>404 Not Found</strong>") - -getStatusCode (HtmlResponse code _) = code -getStatusCode (TextResponse code _ _) = code - -getContentType (HtmlResponse _ _) = (T.pack "text/html") -getContentType (TextResponse _ contentType _) = contentType - -getContent (HtmlResponse _ content) = content -getContent (TextResponse _ _ content) = content - -formResponse :: Response -> Text -formResponse (HtmlResponse code html) = - T.strip $ T.unlines - $ map T.pack [ "HTTP/1.1 " ++ getStatus code - , "Content-Type: text/html; charset=utf-8" - , "Connection: close" - , "" ] ++ [html] |