Mercurial > hg > orthanc
comparison Core/HttpClient.h @ 2041:9f61ca1e3eb3
OrthancPluginHttpClient can return the HTTP headers of the answer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 Jun 2016 17:08:09 +0200 |
parents | 6ea2e264ca50 |
children | 21a8ca9ad928 |
comparison
equal
deleted
inserted
replaced
2040:6ea2e264ca50 | 2041:9f61ca1e3eb3 |
---|---|
70 void Setup(); | 70 void Setup(); |
71 | 71 |
72 void operator= (const HttpClient&); // Assignment forbidden | 72 void operator= (const HttpClient&); // Assignment forbidden |
73 HttpClient(const HttpClient& base); // Copy forbidden | 73 HttpClient(const HttpClient& base); // Copy forbidden |
74 | 74 |
75 bool ApplyInternal(std::string& answer, | 75 bool ApplyInternal(std::string& answerBody, |
76 HttpHeaders* answerHeaders); | 76 HttpHeaders* answerHeaders); |
77 | 77 |
78 bool ApplyInternal(Json::Value& answer, | 78 bool ApplyInternal(Json::Value& answerBody, |
79 HttpHeaders* answerHeaders); | 79 HttpHeaders* answerHeaders); |
80 | 80 |
81 public: | 81 public: |
82 HttpClient(); | 82 HttpClient(); |
83 | 83 |
146 void AddHeader(const std::string& key, | 146 void AddHeader(const std::string& key, |
147 const std::string& value); | 147 const std::string& value); |
148 | 148 |
149 void ClearHeaders(); | 149 void ClearHeaders(); |
150 | 150 |
151 bool Apply(std::string& answer) | 151 bool Apply(std::string& answerBody) |
152 { | 152 { |
153 return ApplyInternal(answer, NULL); | 153 return ApplyInternal(answerBody, NULL); |
154 } | 154 } |
155 | 155 |
156 bool Apply(Json::Value& answer) | 156 bool Apply(Json::Value& answerBody) |
157 { | 157 { |
158 return ApplyInternal(answer, NULL); | 158 return ApplyInternal(answerBody, NULL); |
159 } | 159 } |
160 | 160 |
161 bool Apply(std::string& answer, | 161 bool Apply(std::string& answerBody, |
162 HttpHeaders& answerHeaders) | 162 HttpHeaders& answerHeaders) |
163 { | 163 { |
164 return ApplyInternal(answer, &answerHeaders); | 164 return ApplyInternal(answerBody, &answerHeaders); |
165 } | 165 } |
166 | 166 |
167 bool Apply(Json::Value& answer, | 167 bool Apply(Json::Value& answerBody, |
168 HttpHeaders& answerHeaders) | 168 HttpHeaders& answerHeaders) |
169 { | 169 { |
170 return ApplyInternal(answer, &answerHeaders); | 170 return ApplyInternal(answerBody, &answerHeaders); |
171 } | 171 } |
172 | 172 |
173 HttpStatus GetLastStatus() const | 173 HttpStatus GetLastStatus() const |
174 { | 174 { |
175 return lastStatus_; | 175 return lastStatus_; |
245 | 245 |
246 static void SetDefaultProxy(const std::string& proxy); | 246 static void SetDefaultProxy(const std::string& proxy); |
247 | 247 |
248 static void SetDefaultTimeout(long timeout); | 248 static void SetDefaultTimeout(long timeout); |
249 | 249 |
250 void ApplyAndThrowException(std::string& answer); | 250 void ApplyAndThrowException(std::string& answerBody); |
251 | 251 |
252 void ApplyAndThrowException(Json::Value& answer); | 252 void ApplyAndThrowException(Json::Value& answerBody); |
253 | |
254 void ApplyAndThrowException(std::string& answerBody, | |
255 HttpHeaders& answerHeaders); | |
256 | |
257 void ApplyAndThrowException(Json::Value& answerBody, | |
258 HttpHeaders& answerHeaders); | |
253 }; | 259 }; |
254 } | 260 } |