diff Core/HttpClient.h @ 1606:31f4adefb88f

issuing HTTP requests from the plugin SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Sep 2015 17:37:26 +0200
parents ba0226474e22
children b1291df2f780
line wrap: on
line diff
--- a/Core/HttpClient.h	Tue Sep 01 16:41:16 2015 +0200
+++ b/Core/HttpClient.h	Tue Sep 01 17:37:26 2015 +0200
@@ -50,7 +50,7 @@
     std::string credentials_;
     HttpMethod method_;
     HttpStatus lastStatus_;
-    std::string postData_;
+    std::string body_;  // This only makes sense for POST and PUT requests
     bool isVerbose_;
     long timeout_;
     std::string proxy_;
@@ -103,19 +103,19 @@
       return timeout_;
     }
 
-    void SetPostData(const std::string& data)
+    void SetBody(const std::string& data)
     {
-      postData_ = data;
+      body_ = data;
     }
 
-    std::string& AccessPostData()
+    std::string& GetBody()
     {
-      return postData_;
+      return body_;
     }
 
-    const std::string& AccessPostData() const
+    const std::string& GetBody() const
     {
-      return postData_;
+      return body_;
     }
 
     void SetVerbose(bool isVerbose);
@@ -165,5 +165,9 @@
     static void GlobalFinalize();
 
     static void SetDefaultTimeout(long timeout);
+
+    void ApplyAndThrowException(std::string& answer);
+
+    void ApplyAndThrowException(Json::Value& answer);
   };
 }