diff --git a/src/core/dicom-web-api.ts b/src/core/dicom-web-api.ts index 0f24f709..cd24fe35 100644 --- a/src/core/dicom-web-api.ts +++ b/src/core/dicom-web-api.ts @@ -1,5 +1,6 @@ import { cleanUndefined } from '@/src/utils'; import { api } from 'dicomweb-client-typed'; +import { globalHeaders } from '@/src/utils/fetch'; export interface FetchStudyOptions { studyInstanceUID: string; @@ -66,8 +67,10 @@ function toFile(instance: ArrayBuffer) { } function makeClient(dicomWebRoot: string) { + const headers = Object.fromEntries(globalHeaders.entries()); return new api.DICOMwebClient({ url: dicomWebRoot, + headers, }); } diff --git a/src/utils/fetch.ts b/src/utils/fetch.ts index fb82998f..b1432ef0 100644 --- a/src/utils/fetch.ts +++ b/src/utils/fetch.ts @@ -1,7 +1,7 @@ import { parseUrl } from '@/src/utils/url'; import { Awaitable } from '@vueuse/core'; -const globalHeaders = new Headers(); +export const globalHeaders = new Headers(); export function setGlobalHeader(name: string, value: string) { globalHeaders.set(name, value);