Skip to content

Commit ef3af64

Browse files
committed
fix: support passing an AbortSignal to fetch
1 parent 7685a7b commit ef3af64

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export class Client<T extends Route> {
115115
body: options && "payload" in options ? JSON.stringify(options.payload) : undefined,
116116
cache: options?.cache,
117117
next: options?.next,
118+
signal: options?.signal,
118119
});
119120

120121
const isJsonResponse = fetchResponse.headers.get("content-type")?.startsWith("application/json");

lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export type FetchOptions<R extends Route> = Simplify<Omit<R["settings"], "respon
9696
headers?: HeadersInit;
9797
cache?: RequestInit["cache"];
9898
next?: RequestInit["next"];
99+
signal?: AbortSignal;
99100
}>;
100101

101102
export type OptionsArgument<O> = HasRequiredFields<O> extends true

0 commit comments

Comments
 (0)