diff --git a/packages/requester-utils/src/RequesterUtils.ts b/packages/requester-utils/src/RequesterUtils.ts index fcbfd37c3..94f93125c 100644 --- a/packages/requester-utils/src/RequesterUtils.ts +++ b/packages/requester-utils/src/RequesterUtils.ts @@ -40,11 +40,11 @@ export type DefaultRequestOptions = { }; export type RequestOptions = { - headers: Record; + headers?: Record; timeout?: number; - method: string; + method?: string; searchParams?: string; - prefixUrl: string; + prefixUrl?: string; body?: string | FormData; asStream?: boolean; signal?: AbortSignal; @@ -104,13 +104,14 @@ export async function defaultOptionsHandler( const { headers: preconfiguredHeaders, authHeaders, url } = resourceOptions; const headers = { ...preconfiguredHeaders }; const defaultOptions: RequestOptions = { - headers, method, asStream, signal, prefixUrl: url, }; + defaultOptions.headers = headers; + if (sudo) defaultOptions.headers.sudo = `${sudo}`; // FIXME: Not the best comparison, but...it will have to do for now.