Merge pull request #20 from borromeotlhs/patch-3
create a maintainable way to add HTTP Status codez
This commit is contained in:
commit
3e592adfcd
@ -5,11 +5,9 @@
|
|||||||
return function (connection, code, extension)
|
return function (connection, code, extension)
|
||||||
|
|
||||||
local function getHTTPStatusString(code)
|
local function getHTTPStatusString(code)
|
||||||
if code == 200 then return "OK" end
|
local codez = {200="OK", 400="Bad Request", 404="Not Found", 501="Not Implemented"}
|
||||||
if code == 404 then return "Not Found" end
|
local myResult = codez[code]
|
||||||
if code == 400 then return "Bad Request" end
|
if myResult then return myResult else return "Unknown HTTP Status" end
|
||||||
if code == 501 then return "Not Implemented" end
|
|
||||||
return "Unknown HTTP status"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getMimeType(ext)
|
local function getMimeType(ext)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user