diff --git a/lovebird.lua b/lovebird.lua index 4987255..b0b715e 100644 --- a/lovebird.lua +++ b/lovebird.lua @@ -614,7 +614,12 @@ function lovebird.onrequest(req, client) local str xpcall(function() local data = lovebird.pages[page](lovebird, req) + local contenttype = "text/html" + if string.match(page, "%.json$") then + contenttype = "application/json" + end str = "HTTP/1.1 200 OK\r\n" .. + "Content-Type: " .. contenttype .. "\r\n" .. "Content-Length: " .. #data .. "\r\n" .. "\r\n" .. data end, lovebird.onerror) diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..e4bfb48 --- /dev/null +++ b/main.lua @@ -0,0 +1,5 @@ +lovebird = require "lovebird" + +function love.update() + lovebird.update() +end