comparison 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
comparison
equal deleted inserted replaced
4597:b7fe3494a53c 4605:c8f444e8556d
25 #include "IHttpOutputStream.h" 25 #include "IHttpOutputStream.h"
26 26
27 #include "../ChunkedBuffer.h" 27 #include "../ChunkedBuffer.h"
28 #include "../Compatibility.h" // For ORTHANC_OVERRIDE 28 #include "../Compatibility.h" // For ORTHANC_OVERRIDE
29 29
30 #include <map>
31
32
30 namespace Orthanc 33 namespace Orthanc
31 { 34 {
32 class StringHttpOutput : public IHttpOutputStream 35 class StringHttpOutput : public IHttpOutputStream
33 { 36 {
34 private: 37 private:
35 bool found_; 38 HttpStatus status_;
36 ChunkedBuffer buffer_; 39 ChunkedBuffer body_;
40 ChunkedBuffer headers_;
41 bool validBody_;
42 bool validHeaders_;
37 43
38 public: 44 public:
39 StringHttpOutput() : found_(false) 45 StringHttpOutput();
46
47 virtual void OnHttpStatusReceived(HttpStatus status) ORTHANC_OVERRIDE
40 { 48 {
49 status_ = status;
41 } 50 }
42
43 virtual void OnHttpStatusReceived(HttpStatus status) ORTHANC_OVERRIDE;
44 51
45 virtual void Send(bool isHeader, const void* buffer, size_t length) ORTHANC_OVERRIDE; 52 virtual void Send(bool isHeader, const void* buffer, size_t length) ORTHANC_OVERRIDE;
46 53
47 virtual void DisableKeepAlive() ORTHANC_OVERRIDE 54 virtual void DisableKeepAlive() ORTHANC_OVERRIDE
48 { 55 {
49 } 56 }
50 57
51 void GetOutput(std::string& output); 58 HttpStatus GetStatus() const
59 {
60 return status_;
61 }
62
63 void GetBody(std::string& output);
64
65 void GetHeaders(std::map<std::string, std::string>& target,
66 bool keyToLowerCase);
52 }; 67 };
53 } 68 }