diff Plugins/DicomWeb/DicomWeb.py @ 297:f95cd3af1c7a

DICOMweb: test_transcoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 May 2020 20:58:14 +0200
parents 943166deebcb
children 79ce0f7a9714
line wrap: on
line diff
--- a/Plugins/DicomWeb/DicomWeb.py	Fri May 08 19:15:00 2020 +0200
+++ b/Plugins/DicomWeb/DicomWeb.py	Tue May 12 20:58:14 2020 +0200
@@ -68,7 +68,7 @@
     return DoPost(orthanc, uri, body, headers = headers)
 
 
-def DoGetMultipart(orthanc, uri, headers = {}):
+def DoGetMultipart(orthanc, uri, headers = {}, returnHeaders = False):
     answer = DoGetRaw(orthanc, uri, headers = headers)
 
     header = ''
@@ -93,6 +93,12 @@
     for part in msg.walk():
         payload = part.get_payload(decode = True)
         if payload != None:
-            result.append(payload)
+            if returnHeaders:
+                h = {}
+                for (key, value) in part.items():
+                    h[key] = value
+                result.append((payload, h))
+            else:
+                result.append(payload)
 
     return result