comparison OrthancStone/Sources/Toolbox/OrthancDatasets/OrthancHttpConnection.cpp @ 1776:d3d883c3af65

backward compatibility with Orthanc framework <= 1.9.2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 May 2021 07:34:14 +0200
parents e38b9875a969
children 3889ae96d2e9
comparison
equal deleted inserted replaced
1775:fca942f4b4a7 1776:d3d883c3af65
64 { 64 {
65 boost::mutex::scoped_lock lock(mutex_); 65 boost::mutex::scoped_lock lock(mutex_);
66 66
67 client_.SetMethod(Orthanc::HttpMethod_Post); 67 client_.SetMethod(Orthanc::HttpMethod_Post);
68 client_.SetUrl(url_ + uri); 68 client_.SetUrl(url_ + uri);
69
70 #if defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE) && ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 3)
69 client_.SetExternalBody(body); 71 client_.SetExternalBody(body);
70 client_.ApplyAndThrowException(result); 72 client_.ApplyAndThrowException(result);
71 client_.ClearBody(); 73 client_.ClearBody();
74 #else
75 client_.SetBody(body);
76 client_.ApplyAndThrowException(result);
77 #endif
72 } 78 }
73 79
74 80
75 void OrthancHttpConnection::RestApiPut(std::string& result, 81 void OrthancHttpConnection::RestApiPut(std::string& result,
76 const std::string& uri, 82 const std::string& uri,
78 { 84 {
79 boost::mutex::scoped_lock lock(mutex_); 85 boost::mutex::scoped_lock lock(mutex_);
80 86
81 client_.SetMethod(Orthanc::HttpMethod_Put); 87 client_.SetMethod(Orthanc::HttpMethod_Put);
82 client_.SetUrl(url_ + uri); 88 client_.SetUrl(url_ + uri);
89
90 #if defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE) && ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 3)
83 client_.SetExternalBody(body); 91 client_.SetExternalBody(body);
84 client_.ApplyAndThrowException(result); 92 client_.ApplyAndThrowException(result);
85 client_.ClearBody(); 93 client_.ClearBody();
94 #else
95 client_.SetBody(body);
96 client_.ApplyAndThrowException(result);
97 #endif
86 } 98 }
87 99
88 100
89 void OrthancHttpConnection::RestApiDelete(const std::string& uri) 101 void OrthancHttpConnection::RestApiDelete(const std::string& uri)
90 { 102 {