Skip to content

Commit

Permalink
feat(request): add support for passing in a request option to retriev…
Browse files Browse the repository at this point in the history
…e instances
  • Loading branch information
LachlanNewman committed Feb 21, 2025
1 parent 78c8a48 commit 65f3bac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,16 @@ class DICOMwebClient {
* @param {Object} headers
* @param {Object} responseType
* @param {Function} progressCallback
* @param {XMLHttpRequest} request - if specified, the request to use, otherwise one will be created; useful for adding custom upload and abort listeners/objects
* @return {*}
* @private
*/
_httpGet(url, headers, responseType, progressCallback, withCredentials) {
_httpGet(url, headers, responseType, progressCallback, withCredentials,request) {
return this._httpRequest(url, 'get', headers, {
responseType,
progressCallback,
withCredentials,
request
});
}

Expand Down Expand Up @@ -682,6 +684,7 @@ class DICOMwebClient {
corresponding transfer syntaxes
* @param {Object} params - Additional HTTP GET query parameters
* @param {Function} progressCallback
* @param {XMLHttpRequest} request - if specified, the request to use, otherwise one will be created; useful for adding custom upload and abort listeners/objects
* @private
* @returns {Promise<Array>} Content of HTTP message body parts
*/
Expand All @@ -691,6 +694,7 @@ class DICOMwebClient {
params,
progressCallback,
withCredentials,
request
) {
const headers = {};
const defaultMediaType = 'application/dicom';
Expand Down Expand Up @@ -726,7 +730,7 @@ class DICOMwebClient {
supportedMediaTypes,
);

return this._httpGet(url, headers, 'arraybuffer', progressCallback, withCredentials);
return this._httpGet(url, headers, 'arraybuffer', progressCallback, withCredentials, request);
}

/**
Expand Down Expand Up @@ -1754,6 +1758,7 @@ class DICOMwebClient {
* @param {String} options.studyInstanceUID - Study Instance UID
* @param {String} options.seriesInstanceUID - Series Instance UID
* @param {String} options.sopInstanceUID - SOP Instance UID
* @param {XMLHttpRequest} [options.request] - if specified, the request to use, otherwise one will be created; useful for adding custom upload and abort listeners/objects
* @returns {Promise<ArrayBuffer>} DICOM Part 10 file as Arraybuffer
*/
retrieveInstance(options) {
Expand All @@ -1779,6 +1784,7 @@ class DICOMwebClient {
false,
progressCallback,
withCredentials,
options.request
).then(getFirstResult);
}

Expand All @@ -1790,6 +1796,7 @@ class DICOMwebClient {
false,
progressCallback,
withCredentials,
options.request
).then(getFirstResult);
}

Expand Down

0 comments on commit 65f3bac

Please sign in to comment.