summaryrefslogtreecommitdiff
path: root/Web/Response.hs
diff options
context:
space:
mode:
authorAndrew <saintruler@gmail.com>2020-11-27 17:50:54 +0400
committerAndrew <saintruler@gmail.com>2020-11-27 17:50:54 +0400
commit1cc6cfef971ccb3c1d70f2a5570e445556e4f6fb (patch)
tree4773f8178225068e19bd7418622f8dd9084543ac /Web/Response.hs
parentfb7e450d917ec87202f9de019238b78c1b645328 (diff)
Changed directory structure
Diffstat (limited to 'Web/Response.hs')
-rw-r--r--Web/Response.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Web/Response.hs b/Web/Response.hs
new file mode 100644
index 0000000..b08efb9
--- /dev/null
+++ b/Web/Response.hs
@@ -0,0 +1,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 \ No newline at end of file