local res = ngx.location.capture(url)
local rows = json.decode(res.body)
- if fmt == nil then fmt = '| %s' end
local fct
-- Function
fct = fmt
-- Table
- elseif 0
+ elseif false
or fmt == "table"
or fmt == "table-th"
or fmt == "table-td"
-- Default
else
+ if fmt == nil then fmt = ', %s' end
fct = function(r,i)
+ local i = 0
for k,v in pairs(r) do
- ngx.print(string.format(fmt,v))
- -- ngx.say(v)
+ i = i + 1
+ if i == 1 then
+ ngx.print(v)
+ else
+ ngx.print(string.format(fmt,v))
+ end
end
+ ngx.print('\n')
end
end