Skip to main content
Version: v7.0.0

RequestOptionsType

Configuration options for request creation


Import
import { RequestOptionsType } from "@hyper-fetch/core"

Preview

type RequestOptionsType<GenericEndpoint,AdapterOptions,RequestMethods> = {
abortKey?: string;
auth?: boolean;
cache?: boolean;
cacheKey?: string;
cacheTime?: number;
cancelable?: boolean;
deduplicate?: boolean;
deduplicateTime?: number;
disableRequestInterceptors?: boolean;
disableResponseInterceptors?: boolean;
endpoint: GenericEndpoint;
headers?: HeadersInit;
method?: RequestMethods;
offline?: boolean;
options?: AdapterOptions;
queryKey?: string;
queued?: boolean;
retry?: number;
retryTime?: number;
staleTime?: number;
}

Structure

RequestOptionsType
NameTypeDescription
abortKey
string

Key which will be used to cancel requests. Autogenerated by default.

auth
boolean

Should the onAuth method get called on this request

cache
boolean

Should we save the response to cache

cacheKey
string

Key which will be used to cache requests. Autogenerated by default.

cacheTime
number

Should we trigger garbage collection or leave data in memory

cancelable
boolean

Should enable cancelable mode in the Dispatcher

deduplicate
boolean

Should we deduplicate two requests made at the same time into one

deduplicateTime
number

Time of pooling for the deduplication to be active (default 10ms)

disableRequestInterceptors
boolean

Disable pre-request interceptors

disableResponseInterceptors
boolean

Disable post-request interceptors

endpoint
GenericEndpoint

Determine the endpoint for request request

headers
HeadersInit

Custom headers for request

method
RequestMethods

Request method picked from method names handled by adapter With default adapter it is GET | POST | PATCH | PUT | DELETE

offline
boolean

Do we want to store request made in offline mode for latter use when we go back online

options
AdapterOptions

Additional options for your adapter, by default XHR options

queryKey
string

Key which will be used to queue requests. Autogenerated by default.

queued
boolean

Should the requests from this request be send one-by-one

retry
number

Retry count when request is failed

retryTime
number

Retry time delay between retries

staleTime
number

Time for which the cache is considered up-to-date

On this page