benches/strings: add .gitignore and `make clean`
[nit.git] / lib / neo4j / curl_json.nit
index 77d3650..e458eb1 100644 (file)
@@ -15,7 +15,7 @@
 # cURL requests compatible with the JSON REST APIs.
 module curl_json
 
-import jsonable
+import json::static
 intrude import curl
 
 # An abstract request that defines most of the standard options for Neo4j REST API
@@ -35,14 +35,14 @@ abstract class JsonCurlRequest
        end
 
        # OAuth token
-       var auth: nullable String writable
+       var auth: nullable String is writable
 
        # User agent (is used by github to contact devs in case of problems)
        # Eg. "Awesome-Octocat-App"
-       var user_agent: nullable String writable
+       var user_agent: nullable String is writable
 
        # HTTP headers to send
-       var headers: nullable HeaderMap writable = null
+       var headers: nullable HeaderMap = null is writable
 
 
        # init HTTP headers for Neo4j REST API
@@ -50,6 +50,7 @@ abstract class JsonCurlRequest
                headers = new HeaderMap
                headers["Accept"] = "application/json; charset=UTF-8"
                headers["Transfer-Encoding"] = "chunked"
+               headers["X-Stream"] = "true"
                if auth != null then
                        headers["Authorization"] = "token {auth.to_s}"
                end
@@ -95,7 +96,7 @@ abstract class JsonCurlRequest
                end
 
                var err_hook = execute_hook
-           if err_hook != null then return err_hook
+               if err_hook != null then return err_hook
 
                var err_resp = perform
                if err_resp != null then return err_resp
@@ -125,7 +126,7 @@ end
 class JsonPOST
        super JsonCurlRequest
 
-       var data: nullable Jsonable writable = null
+       var data: nullable Jsonable = null is writable
 
        redef fun init_headers do
                super
@@ -160,7 +161,7 @@ end
 class JsonPUT
        super JsonCurlRequest
 
-       var data: nullable Jsonable writable = null
+       var data: nullable Jsonable = null is writable
 
        redef fun init_headers do
                super