Remove unnecessary if statements
nil is false in lua, just utilizing that fact.
This commit is contained in:
parent
7a1a60f383
commit
91c16d1e24
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
local function validateMethod(method)
|
local function validateMethod(method)
|
||||||
local httpMethods = {GET=true, HEAD=true, POST=true, PUT=true, DELETE=true, TRACE=true, OPTIONS=true, CONNECT=true, PATCH=true}
|
local httpMethods = {GET=true, HEAD=true, POST=true, PUT=true, DELETE=true, TRACE=true, OPTIONS=true, CONNECT=true, PATCH=true}
|
||||||
if httpMethods[method] then return true else return false end
|
-- default for non-existent attributes returns nil, which evaluates to false
|
||||||
|
return httpMethods[method]
|
||||||
end
|
end
|
||||||
|
|
||||||
local function uriToFilename(uri)
|
local function uriToFilename(uri)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user