Mercurial > hg > orthanc
changeset 6171:1b3e041cd99b
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Jun 2025 17:33:32 +0200 (7 days ago) |
parents | dfcac2e0d784 (current diff) 20e44205c260 (diff) |
children | 6b55a6afae69 |
files | |
diffstat | 3 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Jun 11 17:33:16 2025 +0200 +++ b/NEWS Wed Jun 11 17:33:32 2025 +0200 @@ -20,6 +20,10 @@ In Orthanc 1.12.6 and 1.12.7, "RejectSopClasses" was used instead of the expected "RejectedSopClasses" spelling. * Fix the re-encoding of DICOM files larger than 4GB +* Improved translations of HTTP error codes when a plugin calls the core Rest API. + e.g., a plugin could receive an error 17:OrthancPluginErrorCode_UnknownResource when the underlying + Rest handler was actually returning an HTTP error 415. The plugin will now receive an + error 3000:OrthancPluginErrorCode_UnsupportedMediaType. REST API
--- a/OrthancFramework/Sources/HttpServer/IHttpHandler.cpp Wed Jun 11 17:33:16 2025 +0200 +++ b/OrthancFramework/Sources/HttpServer/IHttpHandler.cpp Wed Jun 11 17:33:32 2025 +0200 @@ -51,7 +51,10 @@ if (handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Get, curi, httpHeaders, getArguments, NULL /* no body for GET */, 0)) { - stream.GetBody(answerBody); + if (stream.GetStatus() == HttpStatus_200_Ok) + { + stream.GetBody(answerBody); + } if (answerHeaders != NULL) {
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Wed Jun 11 17:33:16 2025 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Wed Jun 11 17:33:32 2025 +0200 @@ -3242,6 +3242,10 @@ { throw OrthancException(ErrorCode_UnknownResource); } + else if (intHttpStatus == 415) + { + throw OrthancException(ErrorCode_UnsupportedMediaType); + } else { throw OrthancException(ErrorCode_BadRequest);