diff OrthancFramework/Sources/HttpServer/StringHttpOutput.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/StringHttpOutput.h	Wed Mar 17 15:48:31 2021 +0100
+++ b/OrthancFramework/Sources/HttpServer/StringHttpOutput.h	Tue Mar 30 16:34:02 2021 +0200
@@ -27,27 +27,42 @@
 #include "../ChunkedBuffer.h"
 #include "../Compatibility.h"  // For ORTHANC_OVERRIDE
 
+#include <map>
+
+
 namespace Orthanc
 {
   class StringHttpOutput : public IHttpOutputStream
   {
   private:
-    bool          found_;
-    ChunkedBuffer buffer_;
+    HttpStatus    status_;
+    ChunkedBuffer body_;
+    ChunkedBuffer headers_;
+    bool          validBody_;
+    bool          validHeaders_;
 
   public:
-    StringHttpOutput() : found_(false)
+    StringHttpOutput();
+
+    virtual void OnHttpStatusReceived(HttpStatus status) ORTHANC_OVERRIDE
     {
+      status_ = status;
     }
 
-    virtual void OnHttpStatusReceived(HttpStatus status) ORTHANC_OVERRIDE;
-
     virtual void Send(bool isHeader, const void* buffer, size_t length) ORTHANC_OVERRIDE;
 
     virtual void DisableKeepAlive() ORTHANC_OVERRIDE
     {
     }
 
-    void GetOutput(std::string& output);
+    HttpStatus GetStatus() const
+    {
+      return status_;
+    }
+
+    void GetBody(std::string& output);
+
+    void GetHeaders(std::map<std::string, std::string>& target,
+                    bool keyToLowerCase);
   };
 }