@@ -223,7 +223,7 @@ class DICOMwebClient {
223223 let requestInstance = request . instance ? request . instance : new XMLHttpRequest ( ) ;
224224
225225 requestInstance . open ( method , url , true ) ;
226- if ( 'responseType' in request ) {
226+ if ( request . responseType ) {
227227 requestInstance . responseType = request . responseType ;
228228 }
229229
@@ -297,10 +297,8 @@ class DICOMwebClient {
297297 } ;
298298
299299 // Event triggered while download progresses
300- if ( 'progressCallback' in request ) {
301- if ( typeof request . progressCallback === 'function' ) {
302- requestInstance . onprogress = request . progressCallback ;
303- }
300+ if ( typeof request . progressCallback === 'function' ) {
301+ requestInstance . onprogress = request . progressCallback ;
304302 }
305303
306304 if ( requestHooks && areValidRequestHooks ( requestHooks ) ) {
@@ -313,13 +311,11 @@ class DICOMwebClient {
313311 }
314312
315313 // Add withCredentials to request if needed
316- if ( 'withCredentials' in request ) {
317- if ( request . withCredentials ) {
318- requestInstance . withCredentials = true ;
319- }
314+ if ( request . withCredentials ) {
315+ requestInstance . withCredentials = true ;
320316 }
321317
322- if ( 'data' in request ) {
318+ if ( request . data ) {
323319 requestInstance . send ( request . data ) ;
324320 } else {
325321 requestInstance . send ( ) ;
@@ -596,6 +592,7 @@ class DICOMwebClient {
596592 'image/gif' ,
597593 'image/png' ,
598594 'image/jp2' ,
595+ 'image/*' ,
599596 ] ;
600597 } else {
601598 supportedMediaTypes = {
@@ -610,6 +607,7 @@ class DICOMwebClient {
610607 '1.2.840.10008.1.2.4.91' : [ 'image/jp2' ] ,
611608 '1.2.840.10008.1.2.4.92' : [ 'image/jpx' ] ,
612609 '1.2.840.10008.1.2.4.93' : [ 'image/jpx' ] ,
610+ '*' : [ 'image/*' ] ,
613611 } ;
614612
615613 if ( byteRange ) {
@@ -963,7 +961,7 @@ class DICOMwebClient {
963961 } ) ;
964962
965963 if ( ! fieldValueParts . length ) {
966- throw new Error ( `No acceptable media types found among ${ JSON . stringify ( mediaTypes ) } ` ) ;
964+ throw new Error ( `No acceptable media types found among ${ JSON . stringify ( mediaTypes ) } testing against ${ JSON . stringify ( acceptableMediaTypes ) } ` ) ;
967965 }
968966
969967 return fieldValueParts . join ( ', ' ) ;
@@ -1229,7 +1227,7 @@ class DICOMwebClient {
12291227 debugLog ( `retrieve metadata of instance ${ options . sopInstanceUID } ` ) ;
12301228 const url = `${ this . wadoURL } /studies/${ options . studyInstanceUID } /series/${ options . seriesInstanceUID } /instances/${ options . sopInstanceUID } /metadata` ;
12311229
1232- const request = getRequestOptions ( options . request )
1230+ const request = getRequestOptions ( options . request ) ;
12331231 return this . _httpGetApplicationJson ( url , { } , request ) ;
12341232 }
12351233
@@ -1278,6 +1276,7 @@ class DICOMwebClient {
12781276 const { mediaTypes } = options ;
12791277
12801278 const request = getRequestOptions ( options . request )
1279+ request . responseType = 'arraybuffer' ;
12811280
12821281 if ( ! mediaTypes ) {
12831282 return this . _httpGetMultipartApplicationOctetStream (
@@ -1319,7 +1318,6 @@ class DICOMwebClient {
13191318 supportedMediaTypes ,
13201319 ) ,
13211320 } ;
1322- request . responseType = 'arraybuffer' ;
13231321 return this . _httpGet ( url , headers , request ) ;
13241322 }
13251323
0 commit comments