axios 1.21.0 → 1.21.1
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.
- package/CHANGELOG.md +68 -0
- package/README.md +37 -8
- package/dist/axios.js +34 -17
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +29 -12
- package/dist/esm/axios.js +29 -12
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +27 -12
- package/index.d.cts +12 -2
- package/index.d.ts +10 -2
- package/lib/core/dispatchRequest.js +27 -10
- package/lib/env/data.js +1 -1
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.21.0 — October 21, 2026
|
|
4
|
+
|
|
5
|
+
This release adds response timing and opt-in UTF-8 Basic authentication, improves request handling across runtimes, and changes how header defaults are recognized.
|
|
6
|
+
|
|
7
|
+
## ⚠️ Breaking Changes & Deprecations
|
|
8
|
+
|
|
9
|
+
* **Header Defaults:** Only plain objects, null-prototype maps, and compatible `AxiosHeaders` instances are treated as common or method-specific defaults; literal headers such as `Link` are now preserved. Applications using custom class instances as defaults must convert them to plain maps, for example `{ post: { ...customDefaults } }`, or compatible `AxiosHeaders`. Otherwise, those instances become literal header values, including on requests using other methods. (**[#11156](https://github.com/axios/axios/pull/11156)**)
|
|
10
|
+
|
|
11
|
+
## 🚀 New Features
|
|
12
|
+
|
|
13
|
+
* **Response Timing:** Added `response.duration`, in milliseconds, including on `error.response` when present. Timing measures adapter execution and excludes interceptors and transforms; streamed responses stop timing when the stream becomes available. Axios replaces any existing `duration` value supplied by a custom adapter. (**[#11214](https://github.com/axios/axios/pull/11214)**)
|
|
14
|
+
* **UTF-8 Basic Authentication:** Added `transitional.encodeBasicAuthUsername: true` to support Unicode usernames in XHR and Fetch requests. The option defaults to `false`, preserving existing authentication behavior; applications opting in should supply the original Unicode username and remove manual pre-encoding workarounds. (**[#11159](https://github.com/axios/axios/pull/11159)**)
|
|
15
|
+
|
|
16
|
+
## 🐛 Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **Fetch Compatibility:** Restored requests in runtimes such as Cloudflare Workers that reject the implicit `cache: 'default'`, while preserving explicit caller settings. Response-size failures now retain their original `ERR_BAD_RESPONSE` and request context when runtime wrappers replace the underlying stream error. (**[#11194](https://github.com/axios/axios/pull/11194)**, **[#11179](https://github.com/axios/axios/pull/11179)**)
|
|
19
|
+
* **Runtime Consistency:** Aligned encoded-byte size accounting, multipart uploads, proxy routing, same-origin resolution, parameter merging, and form serialization across adapters. Circular parameters now reject with `ERR_BAD_OPTION_VALUE`, and sparse or non-index numeric form fields serialize as keyed objects. With `proxy: false`, native `proxyEnv` agents using unsupported pool-management or TLS-session lifecycle overrides now reject with `ERR_BAD_OPTION_VALUE`; construct those agents without `proxyEnv`. (**[#11242](https://github.com/axios/axios/pull/11242)**)
|
|
20
|
+
* **Header Handling:** Preserved headers named **`__proto__`** using safe casing without changing the `AxiosHeaders` instance prototype. Function matchers in `has()`, `delete()`, and `clear()` now receive the headers instance as `this`, matching their declared contract. (**[#11134](https://github.com/axios/axios/pull/11134)**, **[#11216](https://github.com/axios/axios/pull/11216)**)
|
|
21
|
+
* **URL and Data URL Parsing:** Accepted case-insensitive supported URL schemes and Base64 markers, and corrected decoding of percent-encoded Base64 data URLs. Node data URL allocation estimates remain aligned with decoding so configured size limits apply before allocation. (**[#11138](https://github.com/axios/axios/pull/11138)**, **[#11163](https://github.com/axios/axios/pull/11163)**, **[#11294](https://github.com/axios/axios/pull/11294)**)
|
|
22
|
+
* **Error Diagnostics:** Preserved short reconstructed request stacks and appended wrapped error stacks under `Caused by:` so tooling that reads only `error.stack` retains the original failure context. (**[#11132](https://github.com/axios/axios/pull/11132)**, **[#11142](https://github.com/axios/axios/pull/11142)**)
|
|
23
|
+
* **Interceptor Removal:** Restored removal through canonical numeric-string interceptor IDs, including after registry compaction. (**[#11139](https://github.com/axios/axios/pull/11139)**)
|
|
24
|
+
* **Proxy TLS:** HTTPS CONNECT tunnels now apply current origin TLS options from an explicit `httpsAgent`, or from `https.globalAgent` when no explicit agent is supplied. This preserves process-wide custom CA settings through proxy tunnels. (**[#11178](https://github.com/axios/axios/pull/11178)**)
|
|
25
|
+
* **XHR Lifecycle:** Used asynchronous Cookie Store reads for XSRF tokens where supported, preserving cookie fallback, timeout accounting, and cancellation. Upload and download progress listeners are now removed on completion, failure, timeout, and cancellation. (**[#11166](https://github.com/axios/axios/pull/11166)**, **[#11225](https://github.com/axios/axios/pull/11225)**)
|
|
26
|
+
* **HTTP/2 Sessions:** Stopped reusing sessions immediately after GOAWAY and prevented draining sessions from scheduling idle timers that could delay process exit. (**[#11210](https://github.com/axios/axios/pull/11210)**)
|
|
27
|
+
* **TypeScript Declarations:** Exposed the response-default marker as a public type to resolve `TS2527` when consumers emit declarations involving unresolved response generics, covering both ESM and CommonJS. (**[#11125](https://github.com/axios/axios/pull/11125)**)
|
|
28
|
+
|
|
29
|
+
## 🔧 Maintenance & Chores
|
|
30
|
+
|
|
31
|
+
* **Configuration Performance:** Reduced request configuration merge overhead, particularly for requests with many headers, while preserving merge semantics and prototype-pollution guards. (**[#11208](https://github.com/axios/axios/pull/11208)**)
|
|
32
|
+
* **Same-Origin Checks:** Removed obsolete Internet Explorer detection without changing origin decisions in supported environments. (**[#11174](https://github.com/axios/axios/pull/11174)**)
|
|
33
|
+
* **Dependencies:** Updated `follow-redirects` to 1.16.1 and refreshed development, documentation, test, and GitHub Actions dependencies. Removed unused `dayjs` from the docs package, root `chalk`, and `chai` from CJS module tests. (**[#11169](https://github.com/axios/axios/pull/11169)**, **[#11188](https://github.com/axios/axios/pull/11188)**, **[#11189](https://github.com/axios/axios/pull/11189)**, **[#11195](https://github.com/axios/axios/pull/11195)**, **[#11212](https://github.com/axios/axios/pull/11212)**, **[#11213](https://github.com/axios/axios/pull/11213)**, **[#11218](https://github.com/axios/axios/pull/11218)**, **[#11220](https://github.com/axios/axios/pull/11220)**, **[#11221](https://github.com/axios/axios/pull/11221)**, **[#11230](https://github.com/axios/axios/pull/11230)**, **[#11234](https://github.com/axios/axios/pull/11234)**, **[#11244](https://github.com/axios/axios/pull/11244)**, **[#11245](https://github.com/axios/axios/pull/11245)**, **[#11266](https://github.com/axios/axios/pull/11266)**, **[#11267](https://github.com/axios/axios/pull/11267)**, **[#11268](https://github.com/axios/axios/pull/11268)**, **[#11269](https://github.com/axios/axios/pull/11269)**, **[#11270](https://github.com/axios/axios/pull/11270)**, **[#11271](https://github.com/axios/axios/pull/11271)**, **[#11272](https://github.com/axios/axios/pull/11272)**, **[#11298](https://github.com/axios/axios/pull/11298)**, **[#11302](https://github.com/axios/axios/pull/11302)**, **[#11303](https://github.com/axios/axios/pull/11303)**, **[#11304](https://github.com/axios/axios/pull/11304)**, **[#11305](https://github.com/axios/axios/pull/11305)**, **[#11306](https://github.com/axios/axios/pull/11306)**, **[#11313](https://github.com/axios/axios/pull/11313)**, **[#11321](https://github.com/axios/axios/pull/11321)**, **[#11322](https://github.com/axios/axios/pull/11322)**, **[#11323](https://github.com/axios/axios/pull/11323)**, **[#11342](https://github.com/axios/axios/pull/11342)**)
|
|
34
|
+
* **Documentation:** Fixed interceptor test links, updated README CDN examples to the published 1.20.0 bundle, and corrected guidance on interceptor options and request lifecycle ordering. (**[#11228](https://github.com/axios/axios/pull/11228)**, **[#11149](https://github.com/axios/axios/pull/11149)**, **[#11335](https://github.com/axios/axios/pull/11335)**)
|
|
35
|
+
* **Contributor Workflow:** Consolidated agent instructions in `AGENTS.md`, standardized PR labels, required prerelease notes and validation evidence, and clarified that `npm test` requires installed Playwright browsers. (**[#11238](https://github.com/axios/axios/pull/11238)**, **[#11273](https://github.com/axios/axios/pull/11273)**, **[#11223](https://github.com/axios/axios/pull/11223)**, **[#11284](https://github.com/axios/axios/pull/11284)**)
|
|
36
|
+
* **Sponsors and Support:** Added HeroDevs, Code for Japan, and Sweepico sponsor listings, refreshed sponsor data, and documented extended security support for Axios v0. (**[#11222](https://github.com/axios/axios/pull/11222)**, **[#11249](https://github.com/axios/axios/pull/11249)**, **[#11252](https://github.com/axios/axios/pull/11252)**, **[#11341](https://github.com/axios/axios/pull/11341)**)
|
|
37
|
+
* **Proxy Regression Coverage:** Added a long dotted request-hostname test for `NO_PROXY` handling, extending coverage of an existing denial-of-service fix. (**[#11235](https://github.com/axios/axios/pull/11235)**)
|
|
38
|
+
* **Release Preparation:** Updated package version metadata for 1.21.0. (**[#11346](https://github.com/axios/axios/pull/11346)**)
|
|
39
|
+
|
|
40
|
+
## 🌟 New Contributors
|
|
41
|
+
|
|
42
|
+
Welcome to our 24 new contributors. Thank you for helping improve Axios:
|
|
43
|
+
|
|
44
|
+
* **@lazerg** (**[#11194](https://github.com/axios/axios/pull/11194)**)
|
|
45
|
+
* **@QIU-Guanzong** (**[#11228](https://github.com/axios/axios/pull/11228)**)
|
|
46
|
+
* **@Iams4kura** (**[#11125](https://github.com/axios/axios/pull/11125)**)
|
|
47
|
+
* **@vjymisal0** (**[#11179](https://github.com/axios/axios/pull/11179)**)
|
|
48
|
+
* **@jarrensj** (**[#11238](https://github.com/axios/axios/pull/11238)**)
|
|
49
|
+
* **@LineGu** (**[#11132](https://github.com/axios/axios/pull/11132)**)
|
|
50
|
+
* **@luantaraschi** (**[#11134](https://github.com/axios/axios/pull/11134)**)
|
|
51
|
+
* **@Cyberhet** (**[#11284](https://github.com/axios/axios/pull/11284)**)
|
|
52
|
+
* **@nyxst4ck** (**[#11138](https://github.com/axios/axios/pull/11138)**)
|
|
53
|
+
* **@windcrestai** (**[#11163](https://github.com/axios/axios/pull/11163)**)
|
|
54
|
+
* **@kazuki-netizen** (**[#11294](https://github.com/axios/axios/pull/11294)**)
|
|
55
|
+
* **@bilashcse** (**[#11139](https://github.com/axios/axios/pull/11139)**)
|
|
56
|
+
* **@JiuYue0820** (**[#11149](https://github.com/axios/axios/pull/11149)**)
|
|
57
|
+
* **@official-burak** (**[#11156](https://github.com/axios/axios/pull/11156)**)
|
|
58
|
+
* **@contactjawad** (**[#11159](https://github.com/axios/axios/pull/11159)**)
|
|
59
|
+
* **@wittachai-as** (**[#11174](https://github.com/axios/axios/pull/11174)**)
|
|
60
|
+
* **@yiheng-kkk** (**[#11166](https://github.com/axios/axios/pull/11166)**)
|
|
61
|
+
* **@ShikeChen01** (**[#11208](https://github.com/axios/axios/pull/11208)**)
|
|
62
|
+
* **@cuishuang** (**[#11210](https://github.com/axios/axios/pull/11210)**)
|
|
63
|
+
* **@Truenocancion** (**[#11225](https://github.com/axios/axios/pull/11225)**)
|
|
64
|
+
* **@jakezwang** (**[#11216](https://github.com/axios/axios/pull/11216)**)
|
|
65
|
+
* **@Adityagarg2712** (**[#11214](https://github.com/axios/axios/pull/11214)**)
|
|
66
|
+
* **@Zandereins** (**[#11235](https://github.com/axios/axios/pull/11235)**)
|
|
67
|
+
* **@Plastic-time** (**[#11335](https://github.com/axios/axios/pull/11335)**)
|
|
68
|
+
|
|
69
|
+
[Full Changelog](https://github.com/axios/axios/compare/v1.20.0...v1.21.0)
|
|
70
|
+
|
|
3
71
|
## v1.19.0 — July 22, 2026
|
|
4
72
|
|
|
5
73
|
This release raises the form-data security floor, adds configuration and type-system capabilities, and fixes NO_PROXY matching, interceptor errors, progress reporting, and serialization edge cases.
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
> [!IMPORTANT]
|
|
2
|
-
> [**Get Security Updates for Axios v0 →**](https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&utm_medium=referral&utm_campaign=nes-for-axios_global&utm_content=landing-page_none_20260924_a)
|
|
2
|
+
> [**Get Security Updates for Axios v0 & Early Access Provider →**](https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&utm_medium=referral&utm_campaign=nes-for-axios_global&utm_content=landing-page_none_20260924_a)
|
|
3
3
|
|
|
4
4
|
<h3 align="center">💎 Platinum sponsors <br /></h3>
|
|
5
5
|
<table align="center">
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
align="center"
|
|
104
104
|
title="SAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications."
|
|
105
105
|
>
|
|
106
|
-
|
|
106
|
+
SAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications.
|
|
107
107
|
</p>
|
|
108
108
|
<p align="center">
|
|
109
109
|
<a
|
|
@@ -352,6 +352,29 @@
|
|
|
352
352
|
>
|
|
353
353
|
</p>
|
|
354
354
|
</td>
|
|
355
|
+
<td align="center" valign="middle" width="33.333333333333336%">
|
|
356
|
+
<a
|
|
357
|
+
href="https://namespace.so/github-actions/?utm_source=oss&utm_campaign=axios"
|
|
358
|
+
style="padding: 10px; display: inline-block"
|
|
359
|
+
target="_blank"
|
|
360
|
+
>
|
|
361
|
+
<img
|
|
362
|
+
width="180px"
|
|
363
|
+
src="https://namespace.so/oss/badge.svg"
|
|
364
|
+
alt="CI powered by Namespace"
|
|
365
|
+
/>
|
|
366
|
+
</a>
|
|
367
|
+
<p align="center">
|
|
368
|
+
Actually the fastest way to run <br>your GitHub Actions.
|
|
369
|
+
</p>
|
|
370
|
+
<p align="center">
|
|
371
|
+
<a
|
|
372
|
+
href="https://namespace.so/github-actions/?utm_source=oss&utm_campaign=axios"
|
|
373
|
+
target="_blank"
|
|
374
|
+
><b>namespace.so</b></a
|
|
375
|
+
>
|
|
376
|
+
</p>
|
|
377
|
+
</td>
|
|
355
378
|
</tr>
|
|
356
379
|
</table>
|
|
357
380
|
|
|
@@ -770,9 +793,9 @@ These config options are available for requests. Only `url` is required. Request
|
|
|
770
793
|
allowAbsoluteUrls: true,
|
|
771
794
|
|
|
772
795
|
// `transformRequest` allows changes to the request data before it is sent to the server
|
|
773
|
-
//
|
|
796
|
+
// It runs for every request, whatever the request method
|
|
774
797
|
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
|
775
|
-
// FormData or
|
|
798
|
+
// FormData, Stream, Blob or File
|
|
776
799
|
// You may modify the headers object.
|
|
777
800
|
transformRequest: [function (data, headers) {
|
|
778
801
|
// Do whatever you want to transform the data
|
|
@@ -897,7 +920,7 @@ These config options are available for requests. Only `url` is required. Request
|
|
|
897
920
|
// `responseType` indicates the type of data that the server will respond with
|
|
898
921
|
// options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
|
|
899
922
|
// browser only: 'blob'
|
|
900
|
-
responseType: 'json', // default
|
|
923
|
+
responseType: 'json', // not set by default; see `forcedJSONParsing` below
|
|
901
924
|
|
|
902
925
|
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
|
|
903
926
|
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
|
@@ -1481,7 +1504,7 @@ Axios errors use this structure:
|
|
|
1481
1504
|
| Property | Definition |
|
|
1482
1505
|
| -------- | ---------- |
|
|
1483
1506
|
| message | A quick summary of the error message and the status it failed with. |
|
|
1484
|
-
| name |
|
|
1507
|
+
| name | The error name: usually `AxiosError`, `CanceledError` for cancellations, or the original name of a wrapped error. Use `axios.isAxiosError(error)` to identify Axios errors and `axios.isCancel(error)` to detect cancellations. |
|
|
1485
1508
|
| stack | Stack trace for the error. |
|
|
1486
1509
|
| config | An axios config object with specific instance configurations defined by the user from when the request was made |
|
|
1487
1510
|
| code | Axios error code. The table below lists internal Axios error codes. |
|
|
@@ -1499,10 +1522,12 @@ These are the internal Axios error codes:
|
|
|
1499
1522
|
| ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
|
|
1500
1523
|
| ERR_CANCELED | The user explicitly canceled the request with an AbortSignal or CancelToken. |
|
|
1501
1524
|
| ETIMEDOUT | Request timed out after exceeding the configured Axios timeout. Set `transitional.clarifyTimeoutError` to `true`; otherwise Axios throws a generic `ECONNABORTED` error. |
|
|
1525
|
+
| ECONNREFUSED | The server refused the connection. Set by the Node.js `http` adapter, with the original system error on `error.cause`; the `xhr` and `fetch` adapters report `ERR_NETWORK` instead. |
|
|
1502
1526
|
| ERR_NETWORK | Network-related issue. In the browser, this error can also be caused by a [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/Guides/CORS) or [Mixed Content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content) policy violation. The browser does not allow the JS code to clarify the real reason for the error caused by security issues, so please check the console. |
|
|
1503
1527
|
| ERR_FR_TOO_MANY_REDIRECTS | Request exceeded the configured maximum number of redirects. |
|
|
1504
1528
|
| ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
|
|
1505
1529
|
| ERR_BAD_REQUEST | The request has an unexpected format or is missing required parameters. Usually related to a response with `4xx` status code. |
|
|
1530
|
+
| ERR_FORM_DATA_DEPTH_EXCEEDED | An object exceeds the configured `maxDepth` while serializing `params` or form data. Default limit is 100 levels. Parsing FormData into JSON, by `axios.formToJSON()` or when a spec-compliant `FormData` (one with an `entries()` method) or HTML form is sent with `Content-Type: application/json`, has a fixed limit of 100 levels that `maxDepth` does not change. |
|
|
1506
1531
|
|
|
1507
1532
|
## Handling errors
|
|
1508
1533
|
|
|
@@ -1564,7 +1589,7 @@ axios.get('/user/12345').catch(function (error) {
|
|
|
1564
1589
|
});
|
|
1565
1590
|
```
|
|
1566
1591
|
|
|
1567
|
-
To avoid logging secrets from `error.config`, pass a `redact` array in the request config. Matching config keys are masked case-insensitively at any depth when `AxiosError#toJSON()` is called.
|
|
1592
|
+
To avoid logging secrets from `error.config`, pass a `redact` array in the request config. Matching config keys are masked case-insensitively at any depth when `AxiosError#toJSON()` is called. Objects other than plain objects and `AxiosHeaders` that have a `toJSON()` method, such as `URL` objects, are serialized as-is and not scanned, and credentials inside URL strings are not matched. List the parent key, such as `auth` or `proxy`, to mask the whole value.
|
|
1568
1593
|
|
|
1569
1594
|
```js
|
|
1570
1595
|
axios
|
|
@@ -1986,6 +2011,10 @@ console.log(axios.formToJSON(form));
|
|
|
1986
2011
|
|
|
1987
2012
|
`user[name]` also creates `{ user: { name: ... } }`, while `items[]` creates an array.
|
|
1988
2013
|
|
|
2014
|
+
Field names are paths, so names that collide are combined rather than kept apart. A repeated name becomes an array: two `account` fields produce `{ account: ['standard', 'admin'] }`. When a name is used both as a plain value and as a parent path, the result depends on field order. `account=standard` followed by `account[role]=admin` produces `{ account: { role: 'admin' } }`, and the plain value is lost. The reverse order produces `{ account: [{ role: 'admin' }, 'standard'] }`. If you validate submitted fields, check the object `formToJSON()` returns, which is also what axios sends when it serializes `FormData` as JSON, rather than the original `FormData` entries.
|
|
2015
|
+
|
|
2016
|
+
Field names can nest at most 100 levels deep. A deeper name throws an `AxiosError` with code `ERR_FORM_DATA_DEPTH_EXCEEDED`, including when axios sends a spec-compliant `FormData` (one with an `entries()` method) or an HTML form as JSON. The limit is fixed, and `formSerializer.maxDepth` and `paramsSerializer.maxDepth` do not change it.
|
|
2017
|
+
|
|
1989
2018
|
Axios supports `postForm`, `putForm`, and `patchForm` as shortcuts for the matching HTTP methods with the `Content-Type` header preset to `multipart/form-data`.
|
|
1990
2019
|
|
|
1991
2020
|
## Posting files
|
|
@@ -2393,7 +2422,7 @@ Returns `true` if at least one header has been cleared.
|
|
|
2393
2422
|
|
|
2394
2423
|
If the headers object was changed directly, it can have duplicates with the same name but in different cases.
|
|
2395
2424
|
This method normalizes the headers object by combining duplicate keys into one.
|
|
2396
|
-
Axios uses this method internally
|
|
2425
|
+
Axios uses this method internally before calling each request and response transformer, and once more after the transformers run.
|
|
2397
2426
|
Set `format` to true for converting header names to lowercase and capitalizing the initial letters (`cOntEnt-type` => `Content-Type`)
|
|
2398
2427
|
|
|
2399
2428
|
```js
|
package/dist/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.21.
|
|
1
|
+
/*! Axios v1.21.1 Copyright (c) 2026 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) :
|
|
@@ -427,15 +427,15 @@
|
|
|
427
427
|
function _toConsumableArray(r) {
|
|
428
428
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
429
429
|
}
|
|
430
|
-
function _toPrimitive(t,
|
|
430
|
+
function _toPrimitive(t, e) {
|
|
431
431
|
if ("object" != typeof t || !t) return t;
|
|
432
|
-
var
|
|
433
|
-
if (void 0 !==
|
|
434
|
-
var i =
|
|
432
|
+
var r;
|
|
433
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
434
|
+
var i = r.call(t, e);
|
|
435
435
|
if ("object" != typeof i) return i;
|
|
436
436
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
437
437
|
}
|
|
438
|
-
return ("string" ===
|
|
438
|
+
return ("string" === e ? String : Number)(t);
|
|
439
439
|
}
|
|
440
440
|
function _toPropertyKey(t) {
|
|
441
441
|
var i = _toPrimitive(t, "string");
|
|
@@ -4910,7 +4910,7 @@
|
|
|
4910
4910
|
return estimateDataURLBytes(fragmentIndex === -1 ? url : url.slice(0, fragmentIndex), estimatePercentDecodedBase64Bytes, /; *base64[\t\n\f\r ]*$/i);
|
|
4911
4911
|
}
|
|
4912
4912
|
|
|
4913
|
-
var VERSION = "1.21.
|
|
4913
|
+
var VERSION = "1.21.1";
|
|
4914
4914
|
|
|
4915
4915
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
4916
4916
|
var DEFAULT_REQUEST_OPTIONS = {
|
|
@@ -5674,18 +5674,34 @@
|
|
|
5674
5674
|
}
|
|
5675
5675
|
|
|
5676
5676
|
/**
|
|
5677
|
-
*
|
|
5677
|
+
* Resolve the clock used to time adapter execution.
|
|
5678
5678
|
*
|
|
5679
|
-
*
|
|
5680
|
-
*
|
|
5681
|
-
*
|
|
5679
|
+
* Prefers the monotonic `performance.now()` so wall-clock adjustments do not
|
|
5680
|
+
* skew the measurement, and so frameworks that forbid reading the current
|
|
5681
|
+
* time during prerendering (e.g. Next.js Cache Components) accept it. Falls
|
|
5682
|
+
* back to `Date.now()` in runtimes without the High Resolution Time API.
|
|
5682
5683
|
*
|
|
5683
|
-
* @
|
|
5684
|
+
* @returns {() => number} Millisecond clock
|
|
5685
|
+
*/
|
|
5686
|
+
function resolveClock() {
|
|
5687
|
+
return typeof performance !== 'undefined' && utils$1.isFunction(performance.now) ? function () {
|
|
5688
|
+
return performance.now();
|
|
5689
|
+
} : Date.now;
|
|
5690
|
+
}
|
|
5691
|
+
|
|
5692
|
+
/**
|
|
5693
|
+
* Whole milliseconds elapsed since `start`, floored at zero.
|
|
5694
|
+
*
|
|
5695
|
+
* Rounded so the value stays an integer as with `Date.now()`. The fallback
|
|
5696
|
+
* wall clock can move backwards mid-request, so the result is clamped.
|
|
5697
|
+
*
|
|
5698
|
+
* @param {() => number} now Clock returned by `resolveClock()`
|
|
5699
|
+
* @param {number} start Timestamp read from `now`
|
|
5684
5700
|
*
|
|
5685
5701
|
* @returns {number} Non-negative elapsed milliseconds
|
|
5686
5702
|
*/
|
|
5687
|
-
function elapsedSince(start) {
|
|
5688
|
-
return Math.max(0,
|
|
5703
|
+
function elapsedSince(now, start) {
|
|
5704
|
+
return Math.max(0, Math.round(now() - start));
|
|
5689
5705
|
}
|
|
5690
5706
|
|
|
5691
5707
|
/**
|
|
@@ -5709,10 +5725,11 @@
|
|
|
5709
5725
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
5710
5726
|
}
|
|
5711
5727
|
var adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
5712
|
-
var
|
|
5728
|
+
var now = resolveClock();
|
|
5729
|
+
var start = now();
|
|
5713
5730
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
5714
5731
|
throwIfCancellationRequested(config);
|
|
5715
|
-
response.duration = elapsedSince(start);
|
|
5732
|
+
response.duration = elapsedSince(now, start);
|
|
5716
5733
|
|
|
5717
5734
|
// Expose the current response on config so that transformResponse can
|
|
5718
5735
|
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
@@ -5731,7 +5748,7 @@
|
|
|
5731
5748
|
|
|
5732
5749
|
// Transform response data
|
|
5733
5750
|
if (reason && reason.response) {
|
|
5734
|
-
reason.response.duration = elapsedSince(start);
|
|
5751
|
+
reason.response.duration = elapsedSince(now, start);
|
|
5735
5752
|
config.response = reason.response;
|
|
5736
5753
|
try {
|
|
5737
5754
|
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|