summaryrefslogtreecommitdiff
path: root/Response.hs
diff options
context:
space:
mode:
authorAndrew Guschin <saintruler@gmail.com>2020-11-26 13:55:55 +0400
committerAndrew Guschin <saintruler@gmail.com>2020-11-26 13:55:55 +0400
commit446602fe336ad1c2a23e3d50d7cd1d1356fcc9de (patch)
tree74b8a1ca93c17d22f7876f6aba80ee10c3851d3b /Response.hs
Initial commit
Diffstat (limited to 'Response.hs')
-rw-r--r--Response.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Response.hs b/Response.hs
new file mode 100644
index 0000000..f33777d
--- /dev/null
+++ b/Response.hs
@@ -0,0 +1,15 @@
+module Response where
+
+data Response =
+ HtmlResponse Int String -- Код возврата, содержимое HTML
+ | TextResponse Int String String -- Код возврата, Content-Type, содержимое HTML
+
+
+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