axios 1.20.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 +77 -113
- package/dist/axios.js +953 -283
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +965 -268
- package/dist/esm/axios.js +965 -268
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +940 -242
- package/index.d.cts +31 -2
- package/index.d.ts +27 -2
- package/lib/adapters/fetch.js +73 -20
- package/lib/adapters/http.js +145 -26
- package/lib/adapters/xhr.js +120 -13
- package/lib/core/Axios.js +67 -12
- package/lib/core/AxiosError.js +59 -0
- package/lib/core/AxiosHeaders.js +17 -4
- package/lib/core/InterceptorManager.js +13 -2
- package/lib/core/assertParamsAcyclic.js +49 -0
- package/lib/core/createMultipartBody.js +37 -0
- package/lib/core/dispatchRequest.js +37 -0
- package/lib/core/mergeConfig.js +183 -120
- package/lib/defaults/transitional.js +1 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/AxiosTransformStream.js +11 -2
- package/lib/helpers/Http2Sessions.js +2 -1
- package/lib/helpers/composeSignals.js +6 -3
- package/lib/helpers/cookies.js +30 -6
- package/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/lib/helpers/formDataToBlob.js +113 -0
- package/lib/helpers/formDataToJSON.js +25 -1
- package/lib/helpers/fromDataURI.js +8 -2
- package/lib/helpers/isURLSameOrigin.js +4 -9
- package/lib/helpers/parseHeaders.js +2 -1
- package/lib/helpers/parseProtocol.js +1 -1
- package/lib/helpers/resolveConfig.js +16 -3
- package/lib/helpers/shouldBypassProxy.js +16 -1
- package/lib/utils.js +61 -10
- package/package.json +24 -25
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,3 +1,6 @@
|
|
|
1
|
+
> [!IMPORTANT]
|
|
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
|
+
|
|
1
4
|
<h3 align="center">💎 Platinum sponsors <br /></h3>
|
|
2
5
|
<table align="center">
|
|
3
6
|
<tr>
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
align="center"
|
|
101
104
|
title="SAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications."
|
|
102
105
|
>
|
|
103
|
-
|
|
106
|
+
SAP SE, a global software company, is one of the largest vendors of ERP and other enterprise applications.
|
|
104
107
|
</p>
|
|
105
108
|
<p align="center">
|
|
106
109
|
<a
|
|
@@ -139,32 +142,6 @@
|
|
|
139
142
|
</td>
|
|
140
143
|
</tr>
|
|
141
144
|
<tr width="33.333333333333336%">
|
|
142
|
-
<td align="center" width="33.333333333333336%">
|
|
143
|
-
<a
|
|
144
|
-
href="https://stytch.com/"
|
|
145
|
-
style="padding: 10px; display: inline-block"
|
|
146
|
-
target="_blank"
|
|
147
|
-
>
|
|
148
|
-
<img
|
|
149
|
-
width="90px"
|
|
150
|
-
height="90px"
|
|
151
|
-
src="https://images.opencollective.com/stytch/f84ce43/logo/256.png?height=256"
|
|
152
|
-
alt="Stytch"
|
|
153
|
-
/>
|
|
154
|
-
</a>
|
|
155
|
-
<p
|
|
156
|
-
align="center"
|
|
157
|
-
>
|
|
158
|
-
The identity platform for humans & AI agents
|
|
159
|
-
</p>
|
|
160
|
-
<p align="center">
|
|
161
|
-
<a
|
|
162
|
-
href="https://stytch.com"
|
|
163
|
-
target="_blank"
|
|
164
|
-
><b>stytch.com</b></a
|
|
165
|
-
>
|
|
166
|
-
</p>
|
|
167
|
-
</td>
|
|
168
145
|
<td align="center" width="33.333333333333336%">
|
|
169
146
|
<a
|
|
170
147
|
href="https://rxdb.info/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship&utm_content=logo"
|
|
@@ -215,60 +192,6 @@
|
|
|
215
192
|
>
|
|
216
193
|
</p>
|
|
217
194
|
</td>
|
|
218
|
-
</tr>
|
|
219
|
-
<tr width="33.333333333333336%">
|
|
220
|
-
<td align="center" width="33.333333333333336%">
|
|
221
|
-
<a
|
|
222
|
-
href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
223
|
-
style="padding: 10px; display: inline-block"
|
|
224
|
-
target="_blank"
|
|
225
|
-
>
|
|
226
|
-
<img
|
|
227
|
-
width="71px"
|
|
228
|
-
height="70px"
|
|
229
|
-
src="https://images.opencollective.com/buzzoid-buy-instagram-followers/56a09fe/logo.png"
|
|
230
|
-
alt="Buzzoid - Buy Instagram Followers"
|
|
231
|
-
/>
|
|
232
|
-
</a>
|
|
233
|
-
<p
|
|
234
|
-
align="center"
|
|
235
|
-
>
|
|
236
|
-
At Buzzoid, you can buy Instagram followers through a short checkout flow with safety controls. Rated world's #1 IG service since 2012.
|
|
237
|
-
</p>
|
|
238
|
-
<p align="center">
|
|
239
|
-
<a
|
|
240
|
-
href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
241
|
-
target="_blank"
|
|
242
|
-
><b>buzzoid.com</b></a
|
|
243
|
-
>
|
|
244
|
-
</p>
|
|
245
|
-
</td>
|
|
246
|
-
<td align="center" width="33.333333333333336%">
|
|
247
|
-
<a
|
|
248
|
-
href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
249
|
-
style="padding: 10px; display: inline-block"
|
|
250
|
-
target="_blank"
|
|
251
|
-
>
|
|
252
|
-
<img
|
|
253
|
-
width="71px"
|
|
254
|
-
height="70px"
|
|
255
|
-
src="https://images.opencollective.com/buy-instagram-followers-twicsy/b4c5d7f/logo/256.png?height=256"
|
|
256
|
-
alt="Buy Instagram Followers Twicsy"
|
|
257
|
-
/>
|
|
258
|
-
</a>
|
|
259
|
-
<p
|
|
260
|
-
align="center"
|
|
261
|
-
>
|
|
262
|
-
Buy real Instagram followers from Twicsy. Twicsy has been voted the best site to buy followers from the likes of US Magazine.
|
|
263
|
-
</p>
|
|
264
|
-
<p align="center">
|
|
265
|
-
<a
|
|
266
|
-
href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
267
|
-
target="_blank"
|
|
268
|
-
><b>twicsy.com</b></a
|
|
269
|
-
>
|
|
270
|
-
</p>
|
|
271
|
-
</td>
|
|
272
195
|
<td align="center" width="33.333333333333336%">
|
|
273
196
|
<a
|
|
274
197
|
href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
@@ -351,27 +274,27 @@
|
|
|
351
274
|
</td>
|
|
352
275
|
<td align="center" width="33.333333333333336%">
|
|
353
276
|
<a
|
|
354
|
-
href="https://
|
|
277
|
+
href="https://www.scrapingbee.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
355
278
|
style="padding: 10px; display: inline-block"
|
|
356
279
|
target="_blank"
|
|
357
280
|
>
|
|
358
281
|
<img
|
|
359
|
-
width="
|
|
360
|
-
height="
|
|
361
|
-
src="https://images.opencollective.com/
|
|
362
|
-
alt="
|
|
282
|
+
width="90px"
|
|
283
|
+
height="90px"
|
|
284
|
+
src="https://images.opencollective.com/scrapingbee/6d5dc95/logo.png"
|
|
285
|
+
alt="ScrapingBee"
|
|
363
286
|
/>
|
|
364
287
|
</a>
|
|
365
288
|
<p
|
|
366
289
|
align="center"
|
|
367
290
|
>
|
|
368
|
-
|
|
291
|
+
Scrape websites with a powerful web scraping API without managing proxies, browsers, or anti-bot defenses.
|
|
369
292
|
</p>
|
|
370
293
|
<p align="center">
|
|
371
294
|
<a
|
|
372
|
-
href="https://
|
|
295
|
+
href="https://www.scrapingbee.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
373
296
|
target="_blank"
|
|
374
|
-
><b>
|
|
297
|
+
><b>scrapingbee.com</b></a
|
|
375
298
|
>
|
|
376
299
|
</p>
|
|
377
300
|
</td>
|
|
@@ -379,44 +302,79 @@
|
|
|
379
302
|
<tr width="33.333333333333336%">
|
|
380
303
|
<td align="center" width="33.333333333333336%">
|
|
381
304
|
<a
|
|
382
|
-
href="https://www.
|
|
305
|
+
href="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"
|
|
383
306
|
style="padding: 10px; display: inline-block"
|
|
384
307
|
target="_blank"
|
|
385
308
|
>
|
|
386
309
|
<img
|
|
387
|
-
width="
|
|
388
|
-
height="
|
|
389
|
-
src="https://
|
|
390
|
-
alt="
|
|
310
|
+
width="180px"
|
|
311
|
+
height="53px"
|
|
312
|
+
src="https://axios.rest/sponsors/herodevs.svg"
|
|
313
|
+
alt="HeroDevs"
|
|
391
314
|
/>
|
|
392
315
|
</a>
|
|
393
316
|
<p
|
|
394
317
|
align="center"
|
|
395
318
|
>
|
|
396
|
-
|
|
319
|
+
Security and long-term support for end-of-life open source software.
|
|
397
320
|
</p>
|
|
398
321
|
<p align="center">
|
|
399
322
|
<a
|
|
400
|
-
href="https://www.
|
|
323
|
+
href="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"
|
|
401
324
|
target="_blank"
|
|
402
|
-
><b>
|
|
325
|
+
><b>herodevs.com</b></a
|
|
403
326
|
>
|
|
404
327
|
</p>
|
|
405
328
|
</td>
|
|
406
329
|
<td align="center" width="33.333333333333336%">
|
|
407
330
|
<a
|
|
408
|
-
href="https://opencollective.com/
|
|
331
|
+
href="https://opencollective.com/sweepico-promo-code"
|
|
332
|
+
style="padding: 10px; display: inline-block"
|
|
409
333
|
target="_blank"
|
|
410
|
-
>💜 Become a sponsor</a
|
|
411
334
|
>
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
335
|
+
<img
|
|
336
|
+
width="90px"
|
|
337
|
+
height="90px"
|
|
338
|
+
src="https://images.opencollective.com/sweepico-promo-code/4dd517a/logo.png"
|
|
339
|
+
alt="Sweepico Promo Code"
|
|
340
|
+
/>
|
|
341
|
+
</a>
|
|
342
|
+
<p
|
|
343
|
+
align="center"
|
|
418
344
|
>
|
|
345
|
+
Social Gaming Platform
|
|
346
|
+
</p>
|
|
347
|
+
<p align="center">
|
|
348
|
+
<a
|
|
349
|
+
href="https://opencollective.com/sweepico-promo-code"
|
|
350
|
+
target="_blank"
|
|
351
|
+
><b>Sweepico Promo Code</b></a
|
|
352
|
+
>
|
|
353
|
+
</p>
|
|
419
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>
|
|
420
378
|
</tr>
|
|
421
379
|
</table>
|
|
422
380
|
|
|
@@ -597,13 +555,13 @@ const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundl
|
|
|
597
555
|
Using jsDelivr CDN (ES5 UMD browser module):
|
|
598
556
|
|
|
599
557
|
```html
|
|
600
|
-
<script src="https://cdn.jsdelivr.net/npm/axios@1.
|
|
558
|
+
<script src="https://cdn.jsdelivr.net/npm/axios@1.20.0/dist/axios.min.js"></script>
|
|
601
559
|
```
|
|
602
560
|
|
|
603
561
|
Using unpkg CDN:
|
|
604
562
|
|
|
605
563
|
```html
|
|
606
|
-
<script src="https://unpkg.com/axios@1.
|
|
564
|
+
<script src="https://unpkg.com/axios@1.20.0/dist/axios.min.js"></script>
|
|
607
565
|
```
|
|
608
566
|
|
|
609
567
|
## Example
|
|
@@ -835,9 +793,9 @@ These config options are available for requests. Only `url` is required. Request
|
|
|
835
793
|
allowAbsoluteUrls: true,
|
|
836
794
|
|
|
837
795
|
// `transformRequest` allows changes to the request data before it is sent to the server
|
|
838
|
-
//
|
|
796
|
+
// It runs for every request, whatever the request method
|
|
839
797
|
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
|
840
|
-
// FormData or
|
|
798
|
+
// FormData, Stream, Blob or File
|
|
841
799
|
// You may modify the headers object.
|
|
842
800
|
transformRequest: [function (data, headers) {
|
|
843
801
|
// Do whatever you want to transform the data
|
|
@@ -962,7 +920,7 @@ These config options are available for requests. Only `url` is required. Request
|
|
|
962
920
|
// `responseType` indicates the type of data that the server will respond with
|
|
963
921
|
// options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
|
|
964
922
|
// browser only: 'blob'
|
|
965
|
-
responseType: 'json', // default
|
|
923
|
+
responseType: 'json', // not set by default; see `forcedJSONParsing` below
|
|
966
924
|
|
|
967
925
|
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
|
|
968
926
|
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
|
@@ -1546,7 +1504,7 @@ Axios errors use this structure:
|
|
|
1546
1504
|
| Property | Definition |
|
|
1547
1505
|
| -------- | ---------- |
|
|
1548
1506
|
| message | A quick summary of the error message and the status it failed with. |
|
|
1549
|
-
| 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. |
|
|
1550
1508
|
| stack | Stack trace for the error. |
|
|
1551
1509
|
| config | An axios config object with specific instance configurations defined by the user from when the request was made |
|
|
1552
1510
|
| code | Axios error code. The table below lists internal Axios error codes. |
|
|
@@ -1564,10 +1522,12 @@ These are the internal Axios error codes:
|
|
|
1564
1522
|
| ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
|
|
1565
1523
|
| ERR_CANCELED | The user explicitly canceled the request with an AbortSignal or CancelToken. |
|
|
1566
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. |
|
|
1567
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. |
|
|
1568
1527
|
| ERR_FR_TOO_MANY_REDIRECTS | Request exceeded the configured maximum number of redirects. |
|
|
1569
1528
|
| ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
|
|
1570
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. |
|
|
1571
1531
|
|
|
1572
1532
|
## Handling errors
|
|
1573
1533
|
|
|
@@ -1629,7 +1589,7 @@ axios.get('/user/12345').catch(function (error) {
|
|
|
1629
1589
|
});
|
|
1630
1590
|
```
|
|
1631
1591
|
|
|
1632
|
-
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.
|
|
1633
1593
|
|
|
1634
1594
|
```js
|
|
1635
1595
|
axios
|
|
@@ -2051,6 +2011,10 @@ console.log(axios.formToJSON(form));
|
|
|
2051
2011
|
|
|
2052
2012
|
`user[name]` also creates `{ user: { name: ... } }`, while `items[]` creates an array.
|
|
2053
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
|
+
|
|
2054
2018
|
Axios supports `postForm`, `putForm`, and `patchForm` as shortcuts for the matching HTTP methods with the `Content-Type` header preset to `multipart/form-data`.
|
|
2055
2019
|
|
|
2056
2020
|
## Posting files
|
|
@@ -2458,7 +2422,7 @@ Returns `true` if at least one header has been cleared.
|
|
|
2458
2422
|
|
|
2459
2423
|
If the headers object was changed directly, it can have duplicates with the same name but in different cases.
|
|
2460
2424
|
This method normalizes the headers object by combining duplicate keys into one.
|
|
2461
|
-
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.
|
|
2462
2426
|
Set `format` to true for converting header names to lowercase and capitalizing the initial letters (`cOntEnt-type` => `Content-Type`)
|
|
2463
2427
|
|
|
2464
2428
|
```js
|