FetchOptions
katanakit-js / FetchOptions
Interface: FetchOptions<T>
Section titled “Interface: FetchOptions<T>”Defined in: types/core/http.ts:40
Options passed when executing a fetch request.
URL building lives at the top level — the same shape as useGet,
useRequest and Nuxt’s useFetch — so nothing has to be nested:
useFetch("api", "byId", { method: "GET", params: { id: 25 }, query: { limit: 2 } });Extends
Section titled “Extends”RequestInit
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
T |
any |
The type FetchOptions.transform resolves to. Defaults to any on purpose: with unknown a bare FetchOptions (or one stored in a variable / passed through a wrapper) would no longer be assignable to FetchOptions<T>, which is a type-level break for existing callers. |
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
ignoreDefaultQuery? |
boolean |
Skip the endpoint’s defaultQueryParams instead of merging them. |
types/core/http.ts:46 |
params? |
PathParams |
Path params substituted into :name placeholders of the endpoint. |
types/core/http.ts:42 |
query? |
QueryParams |
Query-string params appended to the URL. | types/core/http.ts:44 |
transform? |
(input) => T | Promise<T> |
Maps the parsed response body to T before it is returned. |
types/core/http.ts:48 |