support changes json API (#116)
use sjson instead of cjson Also take care of backward compatibility before 2.1
This commit is contained in:
parent
c67ed16e10
commit
6158d4b5ba
@ -46,6 +46,10 @@ local function getRequestData(payload)
|
|||||||
local requestData
|
local requestData
|
||||||
return function ()
|
return function ()
|
||||||
--print("Getting Request Data")
|
--print("Getting Request Data")
|
||||||
|
-- for backward compatibility before v2.1
|
||||||
|
if (sjson == nil) then
|
||||||
|
sjson = cjson
|
||||||
|
end
|
||||||
if requestData then
|
if requestData then
|
||||||
return requestData
|
return requestData
|
||||||
else
|
else
|
||||||
@ -60,7 +64,7 @@ local function getRequestData(payload)
|
|||||||
--print("body = [" .. body .. "]")
|
--print("body = [" .. body .. "]")
|
||||||
if mimeType == "application/json" then
|
if mimeType == "application/json" then
|
||||||
--print("JSON: " .. body)
|
--print("JSON: " .. body)
|
||||||
requestData = cjson.decode(body)
|
requestData = sjson.decode(body)
|
||||||
elseif mimeType == "application/x-www-form-urlencoded" then
|
elseif mimeType == "application/x-www-form-urlencoded" then
|
||||||
requestData = parseFormData(body)
|
requestData = parseFormData(body)
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user