🔧 npm update
This commit is contained in:
146
node_modules/axios/README.md
generated
vendored
146
node_modules/axios/README.md
generated
vendored
@@ -1,46 +1,19 @@
|
||||
<h3 align="center">
|
||||
Platinum sponsors
|
||||
<br>
|
||||
</h3>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://runalloy.com?utm_source=github&utm_medium=referral&utm_campaign=121423_axios">
|
||||
<picture>
|
||||
<source width="400px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/f6067247-7eba-4069-852a-ab1bb85b1780">
|
||||
<source width="400px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10">
|
||||
<img width="400px" src="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
<p align="center">Alloy is the integration development platform that makes it simple and <br>fast for SaaS companies to launch critical user-facing integrations.</p>
|
||||
<p align="center">
|
||||
<a href="https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Sign up free</b></a> •
|
||||
<a href="https://docs.runalloy.com/docs?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Documentation</b></a>
|
||||
</p>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Gold sponsors
|
||||
<br><br>
|
||||
</h3>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
|
||||
<picture>
|
||||
<source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/538d715a-13c7-4668-ae7d-37a4548423f4">
|
||||
<source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142">
|
||||
<img width="200px" src="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142" />
|
||||
</picture>
|
||||
</a>
|
||||
<p align="center">API-first authentication, authorization, and fraud prevention</p>
|
||||
<p align="center">
|
||||
<a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> •
|
||||
<a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> • <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js Backend SDK</b></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="38px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/stytch_white.png"> <img width="200px" height="38px" src="https://axios-http.com/assets/sponsors/stytch.png" alt="Stytch"/> </picture> </a> <p align="center" title="API-first authentication, authorization, and fraud prevention">API-first authentication, authorization, and fraud prevention</p> <p align="center"> <a href="https://stytch.com/?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> | <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> | <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>www.principal.com</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we're Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we're Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Documentation</b></a> | <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Community</b></a> </p>
|
||||
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="62px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buzzoid-buy-instagram-followers.png" alt="Buzzoid - Buy Instagram Followers"/> </a> <p align="center" title="At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world's #1 IG service since 2012.">At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate...</p> <p align="center"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>buzzoid.com</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://www.famety.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/famety-buy-instagram-followers.png" alt="Famety - Buy Instagram Followers"/> </a> <p align="center" title="At Famety, you can grow your social media following quickly, safely, and easily with just a few clicks. Rated the world’s #1 social media service since 2013.">At Famety, you can grow your social media following quickly, safely, and easily with just a few clic...</p> <p align="center"> <a href="https://www.famety.com/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>www.famety.com</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://poprey.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/instagram-likes.png" alt="Poprey - Buy Instagram Likes"/> </a> <p align="center" title="Buy Instagram Likes">Buy Instagram Likes</p> <p align="center"> <a href="https://poprey.com/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>poprey.com</b></a> </p>
|
||||
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://musicza.co.za/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="124px" height="52px" src="https://axios-http.com/assets/sponsors/opencollective/musicza.png" alt="Tubidy"/> </a> <p align="center" title="Tubidy: Free Music and Video Downloads | MP3, MP4">Tubidy: Free Music and Video Downloads | MP3, MP4</p> <p align="center"> <a href="https://musicza.co.za/?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>musicza.co.za</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/youtube-subscribers-ssmarket.png" alt="Buy Youtube Subscribers"/> </a> <p align="center" title="SS Market offers professional social media services that rapidly increase your YouTube subscriber count, elevating your channel to a powerful position.">SS Market offers professional social media services that rapidly increase your YouTube subscriber co...</p> <p align="center"> <a href="https://ssmarket.net/buy-youtube-subscribers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>ssmarket.net</b></a> </p>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=sponsorlist&utm_campaign=sponsorship" style="padding: 10px; display: inline-block"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buy-instagram-followers-twicsy.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source=axios&utm_medium=readme_sponsorlist&utm_campaign=sponsorship"><b>twicsy.com</b></a> </p>
|
||||
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a>
|
||||
</td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute">💜 Become a sponsor</a>
|
||||
</td></tr></table>
|
||||
|
||||
<!--<div>marker</div>-->
|
||||
<br><br>
|
||||
<div align="center">
|
||||
<a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
|
||||
@@ -109,6 +82,7 @@
|
||||
- [🆕 Progress capturing](#-progress-capturing)
|
||||
- [🆕 Rate limiting](#-progress-capturing)
|
||||
- [🆕 AxiosHeaders](#-axiosheaders)
|
||||
- [🔥 Fetch adapter](#-fetch-adapter)
|
||||
- [Semver](#semver)
|
||||
- [Promises](#promises)
|
||||
- [TypeScript](#typescript)
|
||||
@@ -130,8 +104,8 @@
|
||||
|
||||
## Browser Support
|
||||
|
||||
 |  |  |  |  |  |
|
||||
--- | --- | --- | --- | --- | --- |
|
||||
 |  |  |  |  |
|
||||
--- | --- | --- | --- | --- |
|
||||
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
||||
|
||||
[](https://saucelabs.com/u/axios)
|
||||
@@ -164,6 +138,12 @@ Using pnpm:
|
||||
$ pnpm add axios
|
||||
```
|
||||
|
||||
Using bun:
|
||||
|
||||
```bash
|
||||
$ bun add axios
|
||||
```
|
||||
|
||||
Once the package is installed, you can import the library using `import` or `require` approach:
|
||||
|
||||
```js
|
||||
@@ -186,6 +166,12 @@ const axios = require('axios');
|
||||
console.log(axios.isCancel('something'));
|
||||
```
|
||||
|
||||
For some bundlers and some ES6 linters you may need to do the following:
|
||||
|
||||
```js
|
||||
import { default as axios } from 'axios';
|
||||
```
|
||||
|
||||
For cases where something went wrong when trying to import a module into a custom or legacy environment,
|
||||
you can try importing the module package directly:
|
||||
|
||||
@@ -199,13 +185,13 @@ const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundl
|
||||
Using jsDelivr CDN (ES5 UMD browser module):
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>
|
||||
```
|
||||
|
||||
Using unpkg CDN:
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/axios@1.1.2/dist/axios.min.js"></script>
|
||||
<script src="https://unpkg.com/axios@1.6.7/dist/axios.min.js"></script>
|
||||
```
|
||||
|
||||
## Example
|
||||
@@ -395,11 +381,16 @@ These are the available config options for making requests. Only the `url` is re
|
||||
// `method` is the request method to be used when making the request
|
||||
method: 'get', // default
|
||||
|
||||
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
||||
// `baseURL` will be prepended to `url` unless `url` is absolute and option `allowAbsoluteUrls` is set to true.
|
||||
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
||||
// to methods of that instance.
|
||||
baseURL: 'https://some-domain.com/api/',
|
||||
|
||||
// `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
|
||||
// When set to true (default), absolute values for `url` will override `baseUrl`.
|
||||
// When set to false, absolute values for `url` will always be prepended by `baseUrl`.
|
||||
allowAbsoluteUrls: true,
|
||||
|
||||
// `transformRequest` allows changes to the request data before it is sent to the server
|
||||
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
|
||||
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
||||
@@ -431,13 +422,13 @@ These are the available config options for making requests. Only the `url` is re
|
||||
// `paramsSerializer` is an optional config that allows you to customize serializing `params`.
|
||||
paramsSerializer: {
|
||||
|
||||
//Custom encoder function which sends key/value pairs in an iterative fashion.
|
||||
// Custom encoder function which sends key/value pairs in an iterative fashion.
|
||||
encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
|
||||
|
||||
// Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour.
|
||||
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
|
||||
|
||||
//Configuration for formatting array indexes in the params.
|
||||
// Configuration for formatting array indexes in the params.
|
||||
indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes).
|
||||
},
|
||||
|
||||
@@ -465,10 +456,13 @@ These are the available config options for making requests. Only the `url` is re
|
||||
withCredentials: false, // default
|
||||
|
||||
// `adapter` allows custom handling of requests which makes testing easier.
|
||||
// Return a promise and supply a valid response (see lib/adapters/README.md).
|
||||
// Return a promise and supply a valid response (see lib/adapters/README.md)
|
||||
adapter: function (config) {
|
||||
/* ... */
|
||||
},
|
||||
// Also, you can set the name of the built-in adapter, or provide an array with their names
|
||||
// to choose the first available in the environment
|
||||
adapter: 'xhr', // 'fetch' | 'http' | ['xhr', 'http', 'fetch']
|
||||
|
||||
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
||||
// This will set an `Authorization` header, overwriting any existing
|
||||
@@ -487,6 +481,9 @@ These are the available config options for making requests. Only the `url` is re
|
||||
|
||||
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
|
||||
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
||||
// options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url',
|
||||
// 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8',
|
||||
// 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
|
||||
responseEncoding: 'utf8', // default
|
||||
|
||||
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
||||
@@ -545,7 +542,11 @@ These are the available config options for making requests. Only the `url` is re
|
||||
// If both are specified, `socketPath` is used.
|
||||
socketPath: null, // default
|
||||
|
||||
// `transport` determines the transport method that will be used to make the request. If defined, it will be used. Otherwise, if `maxRedirects` is 0, the default `http` or `https` library will be used, depending on the protocol specified in `protocol`. Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol, which can handle redirects.
|
||||
// `transport` determines the transport method that will be used to make the request.
|
||||
// If defined, it will be used. Otherwise, if `maxRedirects` is 0,
|
||||
// the default `http` or `https` library will be used, depending on the protocol specified in `protocol`.
|
||||
// Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol,
|
||||
// which can handle redirects.
|
||||
transport: undefined, // default
|
||||
|
||||
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
||||
@@ -707,7 +708,7 @@ instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
||||
|
||||
### Config order of precedence
|
||||
|
||||
Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults/index.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
|
||||
Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults/index.js](https://github.com/axios/axios/blob/main/lib/defaults/index.js#L49), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
|
||||
|
||||
```js
|
||||
// Create an instance using the config defaults provided by the library
|
||||
@@ -729,8 +730,11 @@ instance.get('/longRequest', {
|
||||
You can intercept requests or responses before they are handled by `then` or `catch`.
|
||||
|
||||
```js
|
||||
|
||||
const instance = axios.create();
|
||||
|
||||
// Add a request interceptor
|
||||
axios.interceptors.request.use(function (config) {
|
||||
instance.interceptors.request.use(function (config) {
|
||||
// Do something before request is sent
|
||||
return config;
|
||||
}, function (error) {
|
||||
@@ -739,7 +743,7 @@ axios.interceptors.request.use(function (config) {
|
||||
});
|
||||
|
||||
// Add a response interceptor
|
||||
axios.interceptors.response.use(function (response) {
|
||||
instance.interceptors.response.use(function (response) {
|
||||
// Any status code that lie within the range of 2xx cause this function to trigger
|
||||
// Do something with response data
|
||||
return response;
|
||||
@@ -753,7 +757,8 @@ axios.interceptors.response.use(function (response) {
|
||||
If you need to remove an interceptor later you can.
|
||||
|
||||
```js
|
||||
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
|
||||
const instance = axios.create();
|
||||
const myInterceptor = instance.interceptors.request.use(function () {/*...*/});
|
||||
axios.interceptors.request.eject(myInterceptor);
|
||||
```
|
||||
|
||||
@@ -786,7 +791,7 @@ axios.interceptors.request.use(function (config) {
|
||||
```
|
||||
|
||||
If you want to execute a particular interceptor based on a runtime check,
|
||||
you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return
|
||||
you can add a `runWhen` function to the options object. The request interceptor will not be executed **if and only if** the return
|
||||
of `runWhen` is `false`. The function will be called with the config
|
||||
object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
|
||||
asynchronous request interceptor that only needs to run at certain times.
|
||||
@@ -801,6 +806,8 @@ axios.interceptors.request.use(function (config) {
|
||||
}, null, { runWhen: onGetCall });
|
||||
```
|
||||
|
||||
> **Note:** options parameter(having `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
|
||||
|
||||
### Multiple Interceptors
|
||||
|
||||
Given you add multiple response interceptors
|
||||
@@ -830,7 +837,7 @@ The general structure of axios errors is as follows:
|
||||
| code | Represents an axios identified error. The table below lists out specific definitions for internal axios error. |
|
||||
| status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
|
||||
|
||||
Below is a list of potential axios identified error
|
||||
Below is a list of potential axios identified error:
|
||||
| Code | Definition |
|
||||
| -------- | ---------- |
|
||||
| ERR_BAD_OPTION_VALUE | Invalid or unsupported value provided in axios configuration. |
|
||||
@@ -1141,7 +1148,7 @@ to a `FormData` object by following custom rules.
|
||||
- `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
|
||||
The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON.
|
||||
|
||||
- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects
|
||||
- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects.
|
||||
|
||||
- `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
|
||||
- `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
|
||||
@@ -1270,6 +1277,7 @@ Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
|
||||
## 🆕 Progress capturing
|
||||
|
||||
Axios supports both browser and node environments to capture request upload/download progress.
|
||||
The frequency of progress events is forced to be limited to `3` times per second.
|
||||
|
||||
```js
|
||||
await axios.post(url, data, {
|
||||
@@ -1590,6 +1598,30 @@ The following shortcuts are available:
|
||||
|
||||
- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
|
||||
|
||||
## 🔥 Fetch adapter
|
||||
|
||||
Fetch adapter was introduced in `v1.7.0`. By default, it will be used if `xhr` and `http` adapters are not available in the build,
|
||||
or not supported by the environment.
|
||||
To use it by default, it must be selected explicitly:
|
||||
|
||||
```js
|
||||
const {data} = axios.get(url, {
|
||||
adapter: 'fetch' // by default ['xhr', 'http', 'fetch']
|
||||
})
|
||||
```
|
||||
|
||||
You can create a separate instance for this:
|
||||
|
||||
```js
|
||||
const fetchAxios = axios.create({
|
||||
adapter: 'fetch'
|
||||
});
|
||||
|
||||
const {data} = fetchAxios.get(url);
|
||||
```
|
||||
|
||||
The adapter supports the same functionality as `xhr` adapter, **including upload and download progress capturing**.
|
||||
Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment).
|
||||
|
||||
## Semver
|
||||
|
||||
|
||||
Reference in New Issue
Block a user