response data type
A map of API parameters.
These parameters apply if the original request URL is not absolute, and they can be used to customize the
base API URL depending on the runtime environment. If you define the base API URL via
config#api
or globalOpts.api
, these parameters will be mapped on it.
Request body.
Mind, not every HTTP method can send data in this way. For instance,
GET or HEAD requests can send data only with URLs (@see query
).
Unique cache identifier: it can be useful to create request factories with isolated cache storages
List of request methods that support caching
Strategy of caching for requests that support caching (by default, only GET requests can be cached):
'forever'
- caches all requests and stores their values forever within the active session or
until the cache expires (if cacheTTL
is specified);'queue'
- caches all requests, but more frequent requests will push less frequent requests;'never'
- never caches any requests;Value in milliseconds that indicates how long a request value should keep in the cache (all requests are stored within the active session without expiring by default)
Mime type of the request data (if not specified, it will be cast dynamically)
Enables providing of credentials for cross-domain requests. Also, you can manage to omit any credentials if the used request engine supports it.
A function (or a sequence of functions) takes the current request response data and returns new data to respond. If you provide a sequence of functions, the first function will pass a result to the next function from the sequence, etc.
A function (or a sequence of functions) takes the current request data and returns new data to request. If you provide a sequence of functions, the first function will pass a result in the next function from the sequence, etc.
A request engine to use.
The engine - is a simple function that takes request parameters and returns an abortable promise resolved with the
core/request/response
instance. Mind, some engines provide extra features. For instance, you can listen to upload
progress events with the XHR engine. Or, you can parse responses in a stream form with the Fetch engine.
Additional HTTP request headers.
You can provide them as a simple dictionary or an instance of the Headers class.
Also, you can pass headers as an instance of the core/request/headers
class.
A meta flag that indicates that the request is important: is usually used with middlewares to indicate that the request needs to be executed as soon as possible
Reviver function for JSON.parse
or false to disable defaults.
By default, it parses some strings as Date instances.
A dictionary with some extra parameters for the request: is usually used with middlewares to provide domain-specific information
HTTP method to create a request
A dictionary or iterable value with middleware functions: functions take an environment of request parameters and can modify theirs.
Please notice that the order of middleware depends on the structure you use. Also, if at least one of the middlewares returns a function, invoking this function will be returned as the request result. It can be helpful to organize mocks of data and other similar cases when you don't want to execute a real request.
Enables support of offline caching.
By default, a request can only be taken from a cache if there is no network.
You can customize this logic by providing a custom cache object with the core/cache/decorators/persistent
decorator.
Value in milliseconds that indicates how long a request value should keep in the offline cache
A list of status codes (or a single code) that match successful operation. Also, you can pass a range of codes.
Request parameters that will be serialized to a string and passed via a request URL.
To customize how to encode data to a query string, see querySerializer
.
Type of the response data (if not specified, it will be cast dynamically from the response headers):
'text'
- result is interpreted as a simple string;'json'
- result is interpreted as a JSON object;'document'
- result is interpreted as an XML/HTML document;'formData'
- result is interpreted as a FormData object;'blob'
- result is interpreted as a Blob object;'arrayBuffer'
- result is interpreted as a raw array buffer;'object'
- result is interpreted "as is" without any converting.Options to retry bad requests or a number of maximum request retries
A function (or a sequence of functions) takes the current request response data chunk and yields a new chunk to respond via an async iterator. If you provide a sequence of functions, the first function will pass a result to the next function from the sequence, etc. This parameter is used when you're parsing responses in a stream form.
Value in milliseconds for a request timeout
Returns a serialized value of the specified query object
Options for a request