comparison Resources/Orthanc/Stone/OrthancHttpConnection.cpp @ 238:476d5204d08b

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 May 2021 07:37:08 +0200
parents c2863f5204a8
children 20a730889ae2
comparison
equal deleted inserted replaced
237:c2863f5204a8 238:476d5204d08b
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 {