Skip to content

FetchOptions

katanakit-js / FetchOptions

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 } });
  • RequestInit
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.
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