diff Framework/Toolbox/OrthancApiClient.cpp @ 424:bb573a52fc63 am-vsol-upgrade

allow POST messages with success and failure handlers
author am@osimis.io
date Wed, 21 Nov 2018 17:08:03 +0100
parents 4fe42ae3653a
children b85f635f1eb5
line wrap: on
line diff
--- a/Framework/Toolbox/OrthancApiClient.cpp	Wed Nov 21 17:07:43 2018 +0100
+++ b/Framework/Toolbox/OrthancApiClient.cpp	Wed Nov 21 17:08:03 2018 +0100
@@ -337,7 +337,13 @@
 
   }
 
-  
+  void OrthancApiClient::PostBinaryAsync(
+      const std::string& uri,
+      const std::string& body)
+  {
+    web_.PostAsync(baseUrl_ + uri, IWebService::HttpHeaders(), body, NULL, NULL, NULL);
+  }
+
   void OrthancApiClient::PostJsonAsyncExpectJson(
       const std::string& uri,
       const Json::Value& data,
@@ -350,7 +356,15 @@
     return PostBinaryAsyncExpectJson(uri, body, successCallback, failureCallback, payload);
   }
 
-  
+  void OrthancApiClient::PostJsonAsync(
+      const std::string& uri,
+      const Json::Value& data)
+  {
+    std::string body;
+    MessagingToolbox::JsonToString(body, data);
+    return PostBinaryAsync(uri, body);
+  }
+
   void OrthancApiClient::DeleteAsync(
       const std::string& uri,
       MessageHandler<EmptyResponseReadyMessage>* successCallback,