comparison Plugins/Samples/Common/OrthancPluginConnection.cpp @ 2963:800b4daa6dab

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Dec 2018 09:19:34 +0100
parents 878b59270859
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2962:792a65fdd94b 2963:800b4daa6dab
38 namespace OrthancPlugins 38 namespace OrthancPlugins
39 { 39 {
40 void OrthancPluginConnection::RestApiGet(std::string& result, 40 void OrthancPluginConnection::RestApiGet(std::string& result,
41 const std::string& uri) 41 const std::string& uri)
42 { 42 {
43 OrthancPlugins::MemoryBuffer buffer(context_); 43 OrthancPlugins::MemoryBuffer buffer;
44 44
45 if (buffer.RestApiGet(uri, false)) 45 if (buffer.RestApiGet(uri, false))
46 { 46 {
47 buffer.ToString(result); 47 buffer.ToString(result);
48 } 48 }
55 55
56 void OrthancPluginConnection::RestApiPost(std::string& result, 56 void OrthancPluginConnection::RestApiPost(std::string& result,
57 const std::string& uri, 57 const std::string& uri,
58 const std::string& body) 58 const std::string& body)
59 { 59 {
60 OrthancPlugins::MemoryBuffer buffer(context_); 60 OrthancPlugins::MemoryBuffer buffer;
61 61
62 if (buffer.RestApiPost(uri, body.c_str(), body.size(), false)) 62 if (buffer.RestApiPost(uri, body.c_str(), body.size(), false))
63 { 63 {
64 buffer.ToString(result); 64 buffer.ToString(result);
65 } 65 }
72 72
73 void OrthancPluginConnection::RestApiPut(std::string& result, 73 void OrthancPluginConnection::RestApiPut(std::string& result,
74 const std::string& uri, 74 const std::string& uri,
75 const std::string& body) 75 const std::string& body)
76 { 76 {
77 OrthancPlugins::MemoryBuffer buffer(context_); 77 OrthancPlugins::MemoryBuffer buffer;
78 78
79 if (buffer.RestApiPut(uri, body.c_str(), body.size(), false)) 79 if (buffer.RestApiPut(uri, body.c_str(), body.size(), false))
80 { 80 {
81 buffer.ToString(result); 81 buffer.ToString(result);
82 } 82 }
87 } 87 }
88 88
89 89
90 void OrthancPluginConnection::RestApiDelete(const std::string& uri) 90 void OrthancPluginConnection::RestApiDelete(const std::string& uri)
91 { 91 {
92 OrthancPlugins::MemoryBuffer buffer(context_); 92 OrthancPlugins::MemoryBuffer buffer;
93 93
94 if (!::OrthancPlugins::RestApiDelete(context_, uri, false)) 94 if (!::OrthancPlugins::RestApiDelete(uri, false))
95 { 95 {
96 ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource); 96 ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource);
97 } 97 }
98 } 98 }
99 } 99 }