diff Core/HttpClient.h @ 2040:6ea2e264ca50

retrieval of HTTP headers in answers within HttpClient
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 Jun 2016 16:34:30 +0200
parents 7fe860db9664
children 9f61ca1e3eb3
line wrap: on
line diff
--- a/Core/HttpClient.h	Tue Jun 21 15:17:49 2016 +0200
+++ b/Core/HttpClient.h	Tue Jun 21 16:34:30 2016 +0200
@@ -43,6 +43,9 @@
 {
   class HttpClient
   {
+  public:
+    typedef std::map<std::string, std::string>  HttpHeaders;
+
   private:
     class GlobalParameters;
 
@@ -69,7 +72,11 @@
     void operator= (const HttpClient&);  // Assignment forbidden
     HttpClient(const HttpClient& base);  // Copy forbidden
 
-    bool ApplyInternal(std::string& answer);
+    bool ApplyInternal(std::string& answer,
+                       HttpHeaders* answerHeaders);
+
+    bool ApplyInternal(Json::Value& answer,
+                       HttpHeaders* answerHeaders);
 
   public:
     HttpClient();
@@ -141,9 +148,27 @@
 
     void ClearHeaders();
 
-    bool Apply(std::string& answer);
+    bool Apply(std::string& answer)
+    {
+      return ApplyInternal(answer, NULL);
+    }
+
+    bool Apply(Json::Value& answer)
+    {
+      return ApplyInternal(answer, NULL);
+    }
 
-    bool Apply(Json::Value& answer);
+    bool Apply(std::string& answer,
+               HttpHeaders& answerHeaders)
+    {
+      return ApplyInternal(answer, &answerHeaders);
+    }
+
+    bool Apply(Json::Value& answer,
+               HttpHeaders& answerHeaders)
+    {
+      return ApplyInternal(answer, &answerHeaders);
+    }
 
     HttpStatus GetLastStatus() const
     {