From 187f44306ffa05a495e6f1c0a270b68b511ddc38 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 13 Feb 2017 10:57:05 +0300 Subject: [PATCH 1/2] Fix. setopt socketfunction. --- src/lua/cURL/impl/cURL.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua/cURL/impl/cURL.lua b/src/lua/cURL/impl/cURL.lua index dac178c..ea1b7d0 100644 --- a/src/lua/cURL/impl/cURL.lua +++ b/src/lua/cURL/impl/cURL.lua @@ -681,7 +681,7 @@ function Multi:setopt(k, v) end if k == curl.OPT_SOCKETFUNCTION then - return self:setopt_httppost(wrap_socketfunction(v)) + return self:setopt_socketfunction(v) end return setopt(self, k, v) From 171aa24120f4d8122e15c55cca4de879e45832ea Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 13 Feb 2017 11:20:39 +0300 Subject: [PATCH 2/2] Add. Post JSON example. --- examples/cURLv3/post_json.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/cURLv3/post_json.lua diff --git a/examples/cURLv3/post_json.lua b/examples/cURLv3/post_json.lua new file mode 100644 index 0000000..f41f8f0 --- /dev/null +++ b/examples/cURLv3/post_json.lua @@ -0,0 +1,12 @@ +local cURL = require "cURL" + +c = cURL.easy{ + url = "http://posttestserver.com/post.php", + post = true, + httpheader = { + "Content-Type: application/json"; + }; + postfields = '{"hello": "world"}'; +} + +c:perform() \ No newline at end of file