From 2672d3b46701374fccb7b84121e190ab72d2ad33 Mon Sep 17 00:00:00 2001 From: TJ Borromeo Date: Wed, 6 May 2015 13:54:21 -0700 Subject: [PATCH] Keep return type as is No need for 501 error code, as this should be returned only when needed, and will be much more efficient to not: 1.) take a table entry for the majority of cases when it isn't needed 2.) Utilize only enough memory needed to instantiate a string when it _is_ needed. --- httpserver-header.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpserver-header.lua b/httpserver-header.lua index b3f9134..5f01ef7 100644 --- a/httpserver-header.lua +++ b/httpserver-header.lua @@ -8,7 +8,7 @@ return function (connection, code, extension) local codez = {[200]="OK", [400]="Bad Request", [404]="Not Found",} local myResult = codez[code] -- enforce returning valid http codes all the way throughout? - if myResult then return {[code]=myResult,} else return {[501]="Not Implemented",} end + if myResult then return myResult else return "Not Implemented" end end local function getMimeType(ext)