From eef5ab306a9a5d2fee1c9828980b118184f530ac Mon Sep 17 00:00:00 2001 From: elioat Date: Wed, 5 Jun 2024 22:34:13 -0400 Subject: teapot --- lua/sandborb/route_handler.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lua/sandborb') 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 = "

I'm a teapot!

" + } +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 -- cgit 1.4.1-2-gfad0