about summary refs log tree commit diff stats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/sandborb/route_handler.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/lua/sandborb/route_handler.lua b/lua/sandborb/route_handler.lua
index 7819d3d..77ec7f4 100644
--- a/lua/sandborb/route_handler.lua
+++ b/lua/sandborb/route_handler.lua
@@ -22,6 +22,15 @@ local function gib(e,n)
   }
 end
 
+local function teapot(e)
+  return {
+    code = 418,
+    status = "I'm a teapot",
+    content_type = "text/html, charset=utf-8",
+    body = "<h1>I'm a teapot!</h1>"
+  }
+end
+
 local function error_404(e, p)
   return {
     code = 404,
@@ -49,6 +58,8 @@ function HANDLE_ROUTE(e, path)
     math.randomseed(os.time())
     local number_of_words = math.random(2, 10)
     response = gib(e, number_of_words)
+  elseif path == "/teapot" then
+    response = teapot(e)
   else
     response = error_404(e, path)
   end