lib/curl: `CurlHTTPRequest::datas` to `data`
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 25 Nov 2015 18:29:30 +0000 (13:29 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 25 Nov 2015 19:05:43 +0000 (14:05 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/curl/curl.nit
lib/curl/examples/curl_http.nit

index f225a02..7f754bf 100644 (file)
@@ -79,7 +79,7 @@ class CurlHTTPRequest
        super NativeCurlCallbacks
 
        var url: String
-       var datas: nullable HeaderMap is writable
+       var data: nullable HeaderMap is writable
        var headers: nullable HeaderMap is writable
        var delegate: nullable CurlCallbacks is writable
 
@@ -125,9 +125,9 @@ class CurlHTTPRequest
                end
 
                # Datas
-               var datas = self.datas
-               if datas != null then
-                       var postdatas = datas.to_url_encoded(self.curl)
+               var data = self.data
+               if data != null then
+                       var postdatas = data.to_url_encoded(self.curl)
                        err = self.curl.native.easy_setopt(new CURLOption.postfields, postdatas)
                        if not err.is_ok then return answer_failure(err.to_i, err.to_s)
                end
index d19ee96..9eed5b8 100644 (file)
@@ -64,11 +64,11 @@ else if args[0] == "POST" then
        var my_http_fetcher = new MyHttpFetcher
        request.delegate = my_http_fetcher
 
-       var post_datas = new HeaderMap
-       post_datas["Bugs Bunny"] = "Daffy Duck"
-       post_datas["Batman"] = "Robin likes special characters @#ùà!è§'(\"é&://,;<>∞~*"
-       post_datas["Batman"] = "Yes you can set multiple identical keys, but APACHE will consider only one, the last one"
-       request.datas = post_datas
+       var post_data = new HeaderMap
+       post_data["Bugs Bunny"] = "Daffy Duck"
+       post_data["Batman"] = "Robin likes special characters @#ùà!è§'(\"é&://,;<>∞~*"
+       post_data["Batman"] = "Yes you can set multiple identical keys, but APACHE will consider only one, the last one"
+       request.data = post_data
        var response = request.execute
 
        print "Our body from the callback: {my_http_fetcher.fetched_body}"