Better Fetch

Extra Options

These are better fetch specefic options.

Better Fetch Options

PropTypeDefault
onRequest
<T extends Record<string, any>>(context: RequestContext<T>) => void | RequestContext<any> | Promise<void | RequestContext<any>>
-
onResponse
(context: ResponseContext) => void | ResponseContext | Response | Promise<void | ResponseContext | Response>
-
onSuccess
(context: SuccessContext) => void | Promise<void>
-
onError
(context: ErrorContext) => void | Promise<void>
-
onRetry
(response: ResponseContext) => void | Promise<void>
-
hookOptions
{ cloneResponse?: boolean | undefined; }
-
timeout
number
-
customFetchImpl
FetchEsque
-
plugins
BetterFetchPlugin[]
-
baseURL
string
-
throw
boolean
false
auth
Auth
-
query
any
-
params
any
-
duplex
"full" | "half"
-
jsonParser
<T>(text: string) => Promise<T | undefined>
-
retry
RetryOptions
-
retryAttempt
number
-
output
ZodType<any, ZodTypeDef, any> | { new (blobParts?: BlobPart[] | undefined, options?: BlobPropertyBag | undefined): Blob; prototype: Blob; } | { ...; }
-
errorSchema
ZodType<any, ZodTypeDef, any>
-
disableValidation
boolean
false

On this page