Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 2787:ad2c32082653
Fix OrthancPluginHttpClient() to return the HTTP status on errors
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 26 Jul 2018 10:33:36 +0200 |
parents | a21b244efb37 |
children | 6e3a60b85da6 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Wed Jul 25 13:15:11 2018 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Thu Jul 26 10:33:36 2018 +0200 @@ -1865,11 +1865,16 @@ std::string body; HttpClient::HttpHeaders headers; - client.ApplyAndThrowException(body, headers); + bool success = client.Apply(body, headers); // The HTTP request has succeeded *p.httpStatus = static_cast<uint16_t>(client.GetLastStatus()); + if (!success) + { + HttpClient::ThrowException(client.GetLastStatus()); + } + // Copy the HTTP headers of the answer, if the plugin requested them if (p.answerHeaders != NULL) {