Skip to content
Snippets Groups Projects
Commit ca8fdb90 authored by dg's avatar dg
Browse files

plop

git-svn-id: http://svn.net-core.org/repos/t-engine4@1505 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6ed9e8a0
No related branches found
No related tags found
No related merge requests found
......@@ -202,8 +202,11 @@ function _M:rpc(data)
print("[ONLINE PROFILE] async rpc called", "http://te4.org/lua/profilesrpc.ws/"..data.action)
local body, status = http.request("http://te4.org/lua/profilesrpc.ws/"..data.action, "json="..url.escape(json.encode(data)))
if not body then l:send("final", nil)
else l:send("final", json.decode(body))
if not body then
l:send("final", nil)
else
local ok, ret = pcall(json.decode, body)
l:send("final", ok and ret or nil)
end
return true
end
......@@ -215,7 +218,8 @@ function _M:rpc(data)
print("[ONLINE PROFILE] rpc called", "http://te4.org/lua/profilesrpc.ws/"..data.action)
local body, status = http.request("http://te4.org/lua/profilesrpc.ws/"..data.action, "json="..url.escape(json.encode(data)))
if not body then return end
return json.decode(body)
local ok, ret = pcall(json.decode, body)
return ok and ret or nil
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment