Trying to hook up Defold with the POEditor ( a nifty localization tool).
Sending a normal Curl request with the same arguments it works fine and gives me the response I want but trying the same thing in Defold I’m getting error response that no data was sent using the POST method.
This is what I’m doing:
local header = { ["Content-Type"] = "application/json" }
function M.download_language(lang)
local args = {
api_token = token,
id = project,
action = "export",
type = "key_value_json",
language = lang,
}
M.post(args,function(a,b,c,d) pprint(a) pprint(b) pprint(c) pprint(d) end )
end
function M.post(args, cb)
if type(args) == "table" then
args = json.encode(args)
end
http.request("https://poeditor.com/api/", "POST",
function (self,id,result,sender)
cb(self,id,result,sender)
end, header, args)
end
results:
{
status = 200,
response = {“response”:{“status”:“fail”,“code”:“4012”,“message”:“No data sent using POST method”}},
headers = {
x-powered-by = PHP/5.5.9-1ubuntu4.20,
expires = Thu, 19 Nov 1981 08:52:00 GMT,
content-type = application/json; charset=utf-8,
content-length = 87,
cache-control = no-store, no-cache, must-revalidate, post-check=0, pre-check=0,
pragma = no-cache,
date = Sat, 17 Dec 2016 12:20:39 GMT,
server = Apache/2.4.7 (Ubuntu),
set-cookie = PHPSESSID=m2vkh7qlhdemcc3gi5154krtb0; path=/,
}
}
Have tried everything but no luck. Any suggestions?