⚡ Z-Fetch

✌️ Create Instance Options

A couple of options are available to customize the behavior of a Z-Fetch Instance.

Here is the list of all the available options and their default values when not specified.

Careful

These Options are only applicable when setting up a Z-Fetch instance. Not supported on per request basis.

OptionDescriptionUse CaseDefault Value
baseUrlBase URL for all requestsSet a common base URL for all API requests''
bearerTokenBearer token for authenticationAuthenticate requests with a bearer tokennull
timeoutRequest timeout in millisecondsSet a timeout for requests90000
retryWhether to retry failed requestsAutomatically retry failed requestsfalse
maxRetriesMaximum number of retriesSet a limit on the number of retries3
startPollingWhether to start polling automaticallyEnable automatic pollingfalse
stopPollingWhether to stop polling automaticallyDisable polling after certain conditionsfalse
pollingIntervalInterval between polls in millisecondsSet polling interval5000
revalidateCacheTime in milliseconds before revalidating cached dataRefresh cached data after a specific time10000
withCredentialsWhether to include credentials in requestsInclude credentials like cookiesfalse
withCacheWhether to use caching for GET requestsCache GET request responsestrue
parseJsonWhether to parse response as JSONAutomatically parse JSON responsestrue
stringifyPayloadWhether to stringify request bodyAutomatically stringify request bodytrue
modeCORS mode for requestsSet CORS mode (e.g., 'cors', 'no-cors')'cors'
headersDefault headers for all requestsSet default headers{ 'Content-Type': 'application/json', 'Accept': '*/*' }
hookshooks or interceptorsModify requests and responses on all requests{}

🤔 What about individual request options? See request methods for more details.

And if you think there's something missing, feel free to open an issue on our GitHub repository.