about summary refs log tree commit diff stats
path: root/lua/sandborb
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2024-06-05 22:34:13 -0400
committerelioat <elioat@tilde.institute>2024-06-05 22:34:13 -0400
commiteef5ab306a9a5d2fee1c9828980b118184f530ac (patch)
treee71ae10b09c9e8c5996fc2df1caeacd236d75173 /lua/sandborb
parentc5b5258160e96a16ba11d48d306c5c26c13ee0e7 (diff)
downloadtour-eef5ab306a9a5d2fee1c9828980b118184f530ac.tar.gz
teapot
Diffstat (limited to 'lua/sandborb')
-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