mirror of
https://github.com/rxi/lovebird.git
synced 2024-11-15 22:54:21 +00:00
Add json content type
This commit is contained in:
parent
d34197debb
commit
160114b7ed
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user