diff --git a/source/request.ts b/source/request.ts index 0f604211..8e5f3f47 100644 --- a/source/request.ts +++ b/source/request.ts @@ -34,6 +34,9 @@ export function prepareRequestOptions( if (typeof userOptions.data !== "undefined") { finalOptions.data = userOptions.data; } + if (userOptions.signal) { + finalOptions.signal = userOptions.signal; + } if (context.httpAgent) { finalOptions.httpAgent = context.httpAgent; } diff --git a/source/types.ts b/source/types.ts index e0d6c1e9..cfab0f52 100644 --- a/source/types.ts +++ b/source/types.ts @@ -160,6 +160,7 @@ interface RequestOptionsBase { url?: string; validateStatus?: (status: number) => boolean; withCredentials?: boolean; + signal?: AbortSignal; } export interface RequestOptionsCustom extends RequestOptionsBase {} @@ -285,4 +286,5 @@ export interface WebDAVClientOptions { export interface WebDAVMethodOptions { data?: RequestDataPayload; headers?: Headers; + signal?: AbortSignal; }