Skip to content

Commit

Permalink
removed legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
DorianGray committed Oct 7, 2014
1 parent 3549087 commit 95fc405
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/output/json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,7 @@ local json = config.json
return {
handler = function(context)
context.response.headers["content-type"] = "application/json"

local output = context.output
local meta = getmetatable(output)

if meta and type(meta.__toView) == "function" then
output = meta.__toView(output, context)
end

local raw
if config.encodeEmptyTableAsArray and next(output) == nil then
raw = "[]"
else
raw = json.encode(output)
end

context.response.send(raw)
context.response.send(json.encode(context.output))
end,

options = {
Expand Down

0 comments on commit 95fc405

Please sign in to comment.