Skip to content

Commit c5d6bb3

Browse files
committed
feat(retrieveInstance): add support for passing in a request option: to retrieve instances
1 parent 78c8a48 commit c5d6bb3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/api.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,16 @@ class DICOMwebClient {
314314
* @param {Object} headers
315315
* @param {Object} responseType
316316
* @param {Function} progressCallback
317+
* @param {XMLHttpRequest} request - if specified, the request to use, otherwise one will be created; useful for adding custom upload and abort listeners/objects
317318
* @return {*}
318319
* @private
319320
*/
320-
_httpGet(url, headers, responseType, progressCallback, withCredentials) {
321+
_httpGet(url, headers, responseType, progressCallback, withCredentials,request) {
321322
return this._httpRequest(url, 'get', headers, {
322323
responseType,
323324
progressCallback,
324325
withCredentials,
326+
request
325327
});
326328
}
327329

@@ -682,6 +684,7 @@ class DICOMwebClient {
682684
corresponding transfer syntaxes
683685
* @param {Object} params - Additional HTTP GET query parameters
684686
* @param {Function} progressCallback
687+
* @param {XMLHttpRequest} request - if specified, the request to use, otherwise one will be created; useful for adding custom upload and abort listeners/objects
685688
* @private
686689
* @returns {Promise<Array>} Content of HTTP message body parts
687690
*/
@@ -691,6 +694,7 @@ class DICOMwebClient {
691694
params,
692695
progressCallback,
693696
withCredentials,
697+
request
694698
) {
695699
const headers = {};
696700
const defaultMediaType = 'application/dicom';
@@ -726,7 +730,7 @@ class DICOMwebClient {
726730
supportedMediaTypes,
727731
);
728732

729-
return this._httpGet(url, headers, 'arraybuffer', progressCallback, withCredentials);
733+
return this._httpGet(url, headers, 'arraybuffer', progressCallback, withCredentials, request);
730734
}
731735

732736
/**
@@ -1754,6 +1758,7 @@ class DICOMwebClient {
17541758
* @param {String} options.studyInstanceUID - Study Instance UID
17551759
* @param {String} options.seriesInstanceUID - Series Instance UID
17561760
* @param {String} options.sopInstanceUID - SOP Instance UID
1761+
* @param {XMLHttpRequest} [options.request] - if specified, the request to use, otherwise one will be created; useful for adding custom upload and abort listeners/objects
17571762
* @returns {Promise<ArrayBuffer>} DICOM Part 10 file as Arraybuffer
17581763
*/
17591764
retrieveInstance(options) {
@@ -1779,6 +1784,7 @@ class DICOMwebClient {
17791784
false,
17801785
progressCallback,
17811786
withCredentials,
1787+
options.request
17821788
).then(getFirstResult);
17831789
}
17841790

@@ -1790,6 +1796,7 @@ class DICOMwebClient {
17901796
false,
17911797
progressCallback,
17921798
withCredentials,
1799+
options.request
17931800
).then(getFirstResult);
17941801
}
17951802

0 commit comments

Comments
 (0)