Hi,
I try to make http.request work. I want to send a post_data with it, but I don’t know the correct format.
local function http_result(self, _, response)
print(response.status)
print(response.response)
pprint(response.headers)
end
function init(self)
local postdata = "{'val1':22.34}"
http.request("http://examplepage.org/service","POST",http_result,nil, postdata)
end
results in
{“status”:{“apiCode”:“This value should not be blank.”,“apiMessage”:"([val1])",“httpCode”:400,“httpMessage”:“Bad Request”}}
no matter what I use in “post_data” string. I tried several inputs like “:” instead of “=” and several Brackets []{}. The reference page only refers to “post_data” as a string.
What is the correct format of “post_data” in http.request or am I doing something else wrong?