axios 1.7.0-beta.2 → 1.7.0

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
@@ -125,6 +125,7 @@
125
125
  - [🆕 Progress capturing](#-progress-capturing)
126
126
  - [🆕 Rate limiting](#-progress-capturing)
127
127
  - [🆕 AxiosHeaders](#-axiosheaders)
128
+ - [🔥 Fetch adapter](#-fetch-adapter)
128
129
  - [Semver](#semver)
129
130
  - [Promises](#promises)
130
131
  - [TypeScript](#typescript)
@@ -481,10 +482,13 @@ These are the available config options for making requests. Only the `url` is re
481
482
  withCredentials: false, // default
482
483
 
483
484
  // `adapter` allows custom handling of requests which makes testing easier.
484
- // 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)
485
486
  adapter: function (config) {
486
487
  /* ... */
487
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']
488
492
 
489
493
  // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
490
494
  // This will set an `Authorization` header, overwriting any existing
@@ -1289,6 +1293,7 @@ Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
1289
1293
  ## 🆕 Progress capturing
1290
1294
 
1291
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.
1292
1297
 
1293
1298
  ```js
1294
1299
  await axios.post(url, data, {
@@ -1609,6 +1614,30 @@ The following shortcuts are available:
1609
1614
 
1610
1615
  - `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
1611
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).
1612
1641
 
1613
1642
  ## Semver
1614
1643
 
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.7.0-beta.2 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.7.0 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -3390,7 +3390,7 @@
3390
3390
  return fetch(request);
3391
3391
  case 19:
3392
3392
  response = _context3.sent;
3393
- isStreamResponse = responseType === 'stream' || responseType === 'response';
3393
+ isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3394
3394
  if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
3395
3395
  options = {};
3396
3396
  ['status', 'statusText', 'headers'].forEach(function (prop) {
@@ -3560,7 +3560,7 @@
3560
3560
  });
3561
3561
  }
3562
3562
 
3563
- var VERSION = "1.7.0-beta.2";
3563
+ var VERSION = "1.7.0";
3564
3564
 
3565
3565
  var validators$1 = {};
3566
3566