Skip to content

Commit

Permalink
feat(DICOMWeb): add global headers to requests
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax authored and floryst committed Jan 28, 2025
1 parent 0c75deb commit f2f56f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/core/dicom-web-api.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/fetch.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit f2f56f7

Please sign in to comment.