Mercurial > hg > orthanc-dicomweb
changeset 359:105598b74e1a
Accept multiple MIME types in Accept header for WADO-RS "Retrieve Metadata"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 30 Aug 2019 18:49:50 +0200 |
parents | 09b6511e84f4 |
children | c9cc22e56952 |
files | NEWS Plugin/WadoRs.cpp |
diffstat | 2 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Aug 27 15:53:55 2019 +0200 +++ b/NEWS Fri Aug 30 18:49:50 2019 +0200 @@ -3,6 +3,7 @@ * Support of "window", "viewport" and "quality" parameters in "Retrieve Rendered Transaction" * Fix handling of the "Forwarded" HTTP header +* Accept multiple MIME types in Accept header for WADO-RS "Retrieve Metadata" * Added explicit "Accept" header to avoid uncompressing DICOM files by Google cloud https://groups.google.com/d/msg/orthanc-users/w1Ekrsc6-U8/T2a_DoQ5CwAJ
--- a/Plugin/WadoRs.cpp Tue Aug 27 15:53:55 2019 +0200 +++ b/Plugin/WadoRs.cpp Fri Aug 30 18:49:50 2019 +0200 @@ -116,11 +116,19 @@ std::map<std::string, std::string> attributes; OrthancPlugins::ParseContentType(application, attributes, accept); - if (application == "application/json" || - application == "application/dicom+json" || - application == "*/*") + std::vector<std::string> applicationTokens; + Orthanc::Toolbox::TokenizeString(applicationTokens, application, ','); + + for (size_t i = 0; i < applicationTokens.size(); i++) { - return true; + std::string token = Orthanc::Toolbox::StripSpaces(applicationTokens[i]); + + if (token == "application/json" || + token == "application/dicom+json" || + token == "*/*") + { + return true; + } } if (application != "multipart/related")