axios 1.6.7 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/README.md CHANGED
@@ -25,20 +25,36 @@
25
25
  <br><br>
26
26
  </h3>
27
27
 
28
- <div align="center">
29
- <a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
30
- <picture>
31
- <source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/538d715a-13c7-4668-ae7d-37a4548423f4">
32
- <source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142">
33
- <img width="200px" src="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142" />
34
- </picture>
35
- </a>
36
- <p align="center">API-first authentication, authorization, and fraud prevention</p>
37
- <p align="center">
38
- <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> •
39
- <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>
40
- </p>
41
- </div>
28
+ <table border="0">
29
+ <td align="center">
30
+ <a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
31
+ <picture>
32
+ <source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/538d715a-13c7-4668-ae7d-37a4548423f4">
33
+ <source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142">
34
+ <img width="200px" src="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142" />
35
+ </picture>
36
+ </a>
37
+ <p align="center">API-first authentication, authorization, and fraud prevention</p>
38
+ <p align="center">
39
+ <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> •
40
+ <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>
41
+ </p>
42
+ </td>
43
+ <td align="center">
44
+ <a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
45
+ <picture>
46
+ <source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/79f572f3-9d57-488d-80cc-58d674bb98d8">
47
+ <source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/18b51893-c4b4-4557-b263-74c2b3de84ab">
48
+ <img width="200px" src="https://github.com/axios/axios/assets/4814473/18b51893-c4b4-4557-b263-74c2b3de84ab" />
49
+ </picture>
50
+ </a>
51
+ <p align="center">Drag-and-drop authentication, authorization, and identity management</p>
52
+ <p align="center">
53
+ <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> •
54
+ <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>
55
+ </p>
56
+ </td>
57
+ </table>
42
58
 
43
59
 
44
60
  <br><br>
@@ -109,6 +125,7 @@
109
125
  - [🆕 Progress capturing](#-progress-capturing)
110
126
  - [🆕 Rate limiting](#-progress-capturing)
111
127
  - [🆕 AxiosHeaders](#-axiosheaders)
128
+ - [🔥 Fetch adapter](#-fetch-adapter)
112
129
  - [Semver](#semver)
113
130
  - [Promises](#promises)
114
131
  - [TypeScript](#typescript)
@@ -199,13 +216,13 @@ const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundl
199
216
  Using jsDelivr CDN (ES5 UMD browser module):
200
217
 
201
218
  ```html
202
- <script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
219
+ <script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>
203
220
  ```
204
221
 
205
222
  Using unpkg CDN:
206
223
 
207
224
  ```html
208
- <script src="https://unpkg.com/axios@1.1.2/dist/axios.min.js"></script>
225
+ <script src="https://unpkg.com/axios@1.6.7/dist/axios.min.js"></script>
209
226
  ```
210
227
 
211
228
  ## Example
@@ -465,10 +482,13 @@ These are the available config options for making requests. Only the `url` is re
465
482
  withCredentials: false, // default
466
483
 
467
484
  // `adapter` allows custom handling of requests which makes testing easier.
468
- // Return a promise and supply a valid response (see lib/adapters/README.md).
485
+ // Return a promise and supply a valid response (see lib/adapters/README.md)
469
486
  adapter: function (config) {
470
487
  /* ... */
471
488
  },
489
+ // Also, you can set the name of the built-in adapter, or provide an array with their names
490
+ // to choose the first available in the environment
491
+ adapter: 'xhr' // 'fetch' | 'http' | ['xhr', 'http', 'fetch']
472
492
 
473
493
  // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
474
494
  // This will set an `Authorization` header, overwriting any existing
@@ -487,6 +507,9 @@ These are the available config options for making requests. Only the `url` is re
487
507
 
488
508
  // `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
489
509
  // Note: Ignored for `responseType` of 'stream' or client-side requests
510
+ // options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url',
511
+ // 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8',
512
+ // 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
490
513
  responseEncoding: 'utf8', // default
491
514
 
492
515
  // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
@@ -1270,6 +1293,7 @@ Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
1270
1293
  ## 🆕 Progress capturing
1271
1294
 
1272
1295
  Axios supports both browser and node environments to capture request upload/download progress.
1296
+ The frequency of progress events is forced to be limited to `3` times per second.
1273
1297
 
1274
1298
  ```js
1275
1299
  await axios.post(url, data, {
@@ -1590,6 +1614,30 @@ The following shortcuts are available:
1590
1614
 
1591
1615
  - `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
1592
1616
 
1617
+ ## 🔥 Fetch adapter
1618
+
1619
+ 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,
1620
+ or not supported by the environment.
1621
+ To use it by default, it must be selected explicitly:
1622
+
1623
+ ```js
1624
+ const {data} = axios.get(url, {
1625
+ adapter: 'fetch' // by default ['xhr', 'http', 'fetch']
1626
+ })
1627
+ ```
1628
+
1629
+ You can create a separate instance for this:
1630
+
1631
+ ```js
1632
+ const fetchAxios = axios.create({
1633
+ adapter: 'fetch'
1634
+ });
1635
+
1636
+ const {data} = fetchAxios.get(url);
1637
+ ```
1638
+
1639
+ The adapter supports the same functionality as `xhr` adapter, **including upload and download progress capturing**.
1640
+ Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment).
1593
1641
 
1594
1642
  ## Semver
1595
1643