diff OrthancFramework/Sources/HttpServer/IHttpHandler.h @ 4605:c8f444e8556d

new function in the plugin SDK: OrthancPluginCallRestApi()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 16:34:02 +0200
parents d9473bd5ed43
children 7053502fbf97
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/IHttpHandler.h	Wed Mar 17 15:48:31 2021 +0100
+++ b/OrthancFramework/Sources/HttpServer/IHttpHandler.h	Tue Mar 30 16:34:02 2021 +0200
@@ -83,31 +83,41 @@
                         const void* bodyData,
                         size_t bodySize) = 0;
 
-    static bool SimpleGet(std::string& result,
-                          IHttpHandler& handler,
-                          RequestOrigin origin,
-                          const std::string& uri,
-                          const HttpToolbox::Arguments& httpHeaders);
+
+    /**
+     * In the static functions below, "answerHeaders" can be set to
+     * NULL if the caller has no interest in HTTP headers of the
+     * answer (this avoids some computation).
+     **/
+    static HttpStatus SimpleGet(std::string& answerBody /* out */,
+                                HttpToolbox::Arguments* answerHeaders /* out */,
+                                IHttpHandler& handler,
+                                RequestOrigin origin,
+                                const std::string& uri,
+                                const HttpToolbox::Arguments& httpHeaders);
 
-    static bool SimplePost(std::string& result,
-                           IHttpHandler& handler,
-                           RequestOrigin origin,
-                           const std::string& uri,
-                           const void* bodyData,
-                           size_t bodySize,
-                           const HttpToolbox::Arguments& httpHeaders);
+    static HttpStatus SimplePost(std::string& answerBody /* out */,
+                                 HttpToolbox::Arguments* answerHeaders /* out */,
+                                 IHttpHandler& handler,
+                                 RequestOrigin origin,
+                                 const std::string& uri,
+                                 const void* bodyData,
+                                 size_t bodySize,
+                                 const HttpToolbox::Arguments& httpHeaders);
 
-    static bool SimplePut(std::string& result,
-                          IHttpHandler& handler,
-                          RequestOrigin origin,
-                          const std::string& uri,
-                          const void* bodyData,
-                          size_t bodySize,
-                          const HttpToolbox::Arguments& httpHeaders);
+    static HttpStatus SimplePut(std::string& answerBody /* out */,
+                                HttpToolbox::Arguments* answerHeaders /* out */,
+                                IHttpHandler& handler,
+                                RequestOrigin origin,
+                                const std::string& uri,
+                                const void* bodyData,
+                                size_t bodySize,
+                                const HttpToolbox::Arguments& httpHeaders);
 
-    static bool SimpleDelete(IHttpHandler& handler,
-                             RequestOrigin origin,
-                             const std::string& uri,
-                             const HttpToolbox::Arguments& httpHeaders);
+    static HttpStatus SimpleDelete(HttpToolbox::Arguments* answerHeaders /* out */,
+                                   IHttpHandler& handler,
+                                   RequestOrigin origin,
+                                   const std::string& uri,
+                                   const HttpToolbox::Arguments& httpHeaders);
   };
 }