axios 1.19.0 β†’ 1.21.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +236 -73
  3. package/dist/axios.js +1308 -357
  4. package/dist/axios.min.js +3 -3
  5. package/dist/axios.min.js.map +1 -1
  6. package/dist/browser/axios.cjs +1443 -403
  7. package/dist/esm/axios.js +1443 -403
  8. package/dist/esm/axios.min.js +2 -2
  9. package/dist/esm/axios.min.js.map +1 -1
  10. package/dist/node/axios.cjs +1483 -348
  11. package/index.d.cts +24 -1
  12. package/index.d.ts +22 -1
  13. package/lib/adapters/fetch.js +136 -30
  14. package/lib/adapters/http.js +277 -74
  15. package/lib/adapters/xhr.js +172 -16
  16. package/lib/core/Axios.js +87 -27
  17. package/lib/core/AxiosError.js +59 -0
  18. package/lib/core/AxiosHeaders.js +17 -4
  19. package/lib/core/InterceptorManager.js +118 -8
  20. package/lib/core/assertParamsAcyclic.js +49 -0
  21. package/lib/core/buildFullPath.js +1 -13
  22. package/lib/core/createMultipartBody.js +37 -0
  23. package/lib/core/dispatchRequest.js +28 -2
  24. package/lib/core/mergeConfig.js +183 -120
  25. package/lib/core/methodList.js +17 -0
  26. package/lib/defaults/index.js +2 -1
  27. package/lib/defaults/transitional.js +1 -0
  28. package/lib/env/data.js +1 -1
  29. package/lib/helpers/AxiosTransformStream.js +11 -2
  30. package/lib/helpers/Http2Sessions.js +4 -1
  31. package/lib/helpers/HttpStatusCode.js +11 -1
  32. package/lib/helpers/composeSignals.js +6 -3
  33. package/lib/helpers/cookies.js +30 -6
  34. package/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
  35. package/lib/helpers/formDataToBlob.js +113 -0
  36. package/lib/helpers/formDataToJSON.js +25 -1
  37. package/lib/helpers/fromDataURI.js +11 -4
  38. package/lib/helpers/isURLSameOrigin.js +4 -9
  39. package/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  40. package/lib/helpers/parseHeaders.js +2 -1
  41. package/lib/helpers/parseProtocol.js +1 -1
  42. package/lib/helpers/progressEventReducer.js +1 -1
  43. package/lib/helpers/resolveConfig.js +20 -5
  44. package/lib/helpers/shouldBypassProxy.js +197 -6
  45. package/lib/helpers/throttle.js +3 -2
  46. package/lib/helpers/toFormData.js +14 -21
  47. package/lib/utils.js +192 -20
  48. package/package.json +1 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.19.0 β€” July 22, 2026
4
+
5
+ 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.
6
+
7
+ ## πŸ”’ Security Fixes
8
+
9
+ - Multipart Form Data: Raised the form-data dependency floor to ^4.0.6, preventing fresh installations from resolving versions affected by the CRLF injection vulnerability GHSA-hmw2-7cc7-3qxx (https://github.com/advisories/GHSA-hmw2-7cc7-3qxx). (#11028)
10
+
11
+ ## πŸš€ New Features
12
+
13
+ - Configuration Extensibility: Preserved own-enumerable symbol-keyed fields through mergeConfig and added a generic params type across public TypeScript declarations, responses, errors,
14
+ adapters, and serializers. (#11043, #11081)
15
+ - Header Parameter Parsing: Added the opt-in AxiosHeaders.parseParameters() parser for quote-aware, RFC-style HTTP parameter parsing while preserving legacy parsing behavior. (#11051)
16
+ - HTTP Status Codes: Added the missing Cloudflare 520 WebServerReturnsAnUnknownError status and matching ESM/CJS declarations. (#11067)
17
+
18
+ ## πŸ› Bug Fixes
19
+
20
+ - Form Data Conversion: Limited formDataToJSON path splitting to dot and bracket notation, preserving literal punctuation in keys, and removed browser-facing Buffer.from usage from toFormData to avoid unnecessary polyfills. (#11006, #11018)
21
+ - Proxy Bypass: Canonicalized IPv4 shorthand, octal, and hexadecimal forms during NO_PROXY matching and honored * entries within comma- or space-separated bypass lists. (#11029, #11053)
22
+ - Cancellation: Propagated already-aborted input signals immediately when composing abort signals. (#11035)
23
+ - Header Handling: Preserved empty first values for duplicate singleton headers and made AxiosHeaders#getSetCookie() consistently return arrays for present values. (#11036, #11037)
24
+ - URL Handling: Included normalized, safely redacted offending URLs in malformed-protocol errors and removed repeated trailing slashes when combining base URLs. (#11008, #11038)
25
+
26
+ - Progress Events: Clamped malformed negative progress values to zero and ensured final Node.js download progress events are delivered before streamed responses close. (#11039, #11040)
27
+ - Error and JSON Serialization: Serialized Set values as arrays in JSON-compatible snapshots and synthesized useful AxiosError messages from otherwise-empty AggregateError instances. (#11044, #11059)
28
+ - Content-Length Enforcement: Corrected base64 data: URL size estimation so maxContentLength is enforced consistently by the HTTP and Fetch adapters. (#11061)
29
+ - Synchronous Interceptors: Prevented requests from being dispatched after synchronous request interceptors fail unless their paired rejection handler resolves successfully. (#11071)
30
+
31
+ ## πŸ”§ Maintenance & Chores
32
+
33
+ - Dependencies: Updated development and test tooling, the docs fixture's Axios version, and GitHub Actions integrations including Checkout, Setup Node, Setup Deno, and Zizmor. (#11031, #11055, #11056, #11058, #11079, #11080, #11088, #11089, #11090)
34
+ - Build Outputs: Limited sourcemap generation to published minified bundles, removing broken map references from non-minified builds. (#11054)
35
+ - Form Data Internals: Centralized FormData header handling and made the Node.js adapter tolerate getHeaders() returning undefined under the content-only policy. (#11062)
36
+ - Developer Experience: Ignored common local AI-tooling directories and fixed a constant-reassignment crash when the development sandbox serves its root path. (#11032, #11073)
37
+ - Documentation: Updated sponsor information, clarified that baseURL is not a path-security boundary, scoped provenance claims to attested releases, and corrected the configuration-defaults documentation. (#11041, #11068, #11076, #11078)
38
+ - Publishing: Simplified v1 publishing to use the npm version bundled with Node.js 26 and updated package metadata for the 1.19.0 release. (#11083, #11095)
39
+
40
+ ## 🌟 New Contributors
41
+
42
+ We are thrilled to welcome our new contributors. Thank you for helping improve Axios:
43
+
44
+ - @afonsojramos (#11028)
45
+ - @MahinAnowar (#11006)
46
+ - @yassertawfik4 (#11024)
47
+ - @AnandSundar (#11029)
48
+ - @lin-hongkuan (#11035)
49
+ - @Wali007-lab (#11054)
50
+ - @magicdawn (#11043)
51
+ - @andrewkernel (#11053)
52
+ - @Sagargupta16 (#11059)
53
+ - @Rpaudel379 (#11078)
54
+ - @kobihikri (#11076)
55
+ - @spokodev (#11061)
56
+ - @shaedrich (#11081)
57
+ - @QodeXcli (#11062)
58
+ - @akahoshi1421 (#11067)
59
+ - @TheHonoredOne914 (#11071)
60
+ - @Ahsan1Murtaza (#11073)
61
+
62
+ [Full Changelog](https://github.com/axios/axios/compare/v1.18.1...v1.19.0)
63
+
64
+
3
65
  ## v1.18.0 β€” June 13, 2026
4
66
 
5
67
  This release hardens redirect and URL handling, improves the validateStatus configuration semantics, and includes updates to documentation, dependencies, and release metadata.
package/README.md CHANGED
@@ -1,3 +1,6 @@
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)
3
+
1
4
  <h3 align="center">πŸ’Ž Platinum sponsors <br /></h3>
2
5
  <table align="center">
3
6
  <tr>
@@ -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,146 +192,165 @@
215
192
  >
216
193
  </p>
217
194
  </td>
218
- </tr>
219
- <tr width="33.333333333333336%">
220
195
  <td align="center" width="33.333333333333336%">
221
196
  <a
222
- href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
197
+ href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
223
198
  style="padding: 10px; display: inline-block"
224
199
  target="_blank"
225
200
  >
226
201
  <img
227
202
  width="71px"
228
203
  height="70px"
229
- src="https://images.opencollective.com/buzzoid-buy-instagram-followers/56a09fe/logo.png"
230
- alt="Buzzoid - Buy Instagram Followers"
204
+ src="https://images.opencollective.com/fun88-official/bf2843c/logo.png"
205
+ alt="Fun 88"
231
206
  />
232
207
  </a>
233
208
  <p
234
209
  align="center"
235
210
  >
236
- At Buzzoid, you can buy Instagram followers through a short checkout flow with safety controls. Rated world&#39;s #1 IG service since 2012.
211
+ Fun88 is a global online gambling and betting brand founded in 2009, offering a wide range of services including sports betting, live casino games, slots, and virtual gaming.
237
212
  </p>
238
213
  <p align="center">
239
214
  <a
240
- href="https://buzzoid.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
215
+ href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
241
216
  target="_blank"
242
- ><b>buzzoid.com</b></a
217
+ ><b>global.fun88.com</b></a
243
218
  >
244
219
  </p>
245
220
  </td>
221
+ </tr>
222
+ <tr width="33.333333333333336%">
246
223
  <td align="center" width="33.333333333333336%">
247
224
  <a
248
- href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
225
+ href="https://www.jbo88b.com/vn/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
249
226
  style="padding: 10px; display: inline-block"
250
227
  target="_blank"
251
228
  >
252
229
  <img
253
230
  width="71px"
254
231
  height="70px"
255
- src="https://images.opencollective.com/buy-instagram-followers-twicsy/b4c5d7f/logo/256.png?height=256"
256
- alt="Buy Instagram Followers Twicsy"
232
+ src="https://images.opencollective.com/jbo-vietnam/3fc6159/avatar.png"
233
+ alt="JBO Vietnam"
257
234
  />
258
235
  </a>
259
236
  <p
260
237
  align="center"
261
238
  >
262
- Buy real Instagram followers from Twicsy. Twicsy has been voted the best site to buy followers from the likes of US Magazine.
239
+ JBO Vietnam is a prominent online entertainment brand in Vietnam, offering sports betting, esports, online casino games, and a wide range of other exciting games.
263
240
  </p>
264
241
  <p align="center">
265
242
  <a
266
- href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
243
+ href="https://www.jbo88b.com/vn/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
267
244
  target="_blank"
268
- ><b>twicsy.com</b></a
245
+ ><b>jbo88b.com</b></a
269
246
  >
270
247
  </p>
271
248
  </td>
272
249
  <td align="center" width="33.333333333333336%">
273
250
  <a
274
- href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
251
+ href="https://www.jbo579.com/th/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
275
252
  style="padding: 10px; display: inline-block"
276
253
  target="_blank"
277
254
  >
278
255
  <img
279
256
  width="71px"
280
257
  height="70px"
281
- src="https://images.opencollective.com/fun88-official/bf2843c/logo.png"
282
- alt="Fun 88"
258
+ src="https://images.opencollective.com/jbo-thailand/d17e84f/avatar.png"
259
+ alt="JBO Thailand"
283
260
  />
284
261
  </a>
285
262
  <p
286
263
  align="center"
287
264
  >
288
- Fun88 is a global online gambling and betting brand founded in 2009, offering a wide range of services including sports betting, live casino games, slots, and virtual gaming.
265
+ JBO Thailand is a prominent online entertainment brand in Thailand, offering sports betting, esports, online casino games, and a wide range of other exciting games.
289
266
  </p>
290
267
  <p align="center">
291
268
  <a
292
- href="https://global.fun88.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
269
+ href="https://www.jbo579.com/th/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
293
270
  target="_blank"
294
- ><b>global.fun88.com</b></a
271
+ ><b>jbo88b.com</b></a
295
272
  >
296
273
  </p>
297
274
  </td>
298
- </tr>
299
- <tr width="33.333333333333336%">
300
275
  <td align="center" width="33.333333333333336%">
301
276
  <a
302
- href="https://www.jbo88b.com/vn/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
277
+ href="https://www.scrapingbee.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
303
278
  style="padding: 10px; display: inline-block"
304
279
  target="_blank"
305
280
  >
306
281
  <img
307
- width="71px"
308
- height="70px"
309
- src="https://images.opencollective.com/jbo-vietnam/3fc6159/avatar.png"
310
- alt="JBO Vietnam"
282
+ width="90px"
283
+ height="90px"
284
+ src="https://images.opencollective.com/scrapingbee/6d5dc95/logo.png"
285
+ alt="ScrapingBee"
311
286
  />
312
287
  </a>
313
288
  <p
314
289
  align="center"
315
290
  >
316
- JBO Vietnam is a prominent online entertainment brand in Vietnam, offering sports betting, esports, online casino games, and a wide range of other exciting games.
291
+ Scrape websites with a powerful web scraping API without managing proxies, browsers, or anti-bot defenses.
317
292
  </p>
318
293
  <p align="center">
319
294
  <a
320
- href="https://www.jbo88b.com/vn/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
295
+ href="https://www.scrapingbee.com/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
321
296
  target="_blank"
322
- ><b>jbo88b.com</b></a
297
+ ><b>scrapingbee.com</b></a
323
298
  >
324
299
  </p>
325
300
  </td>
301
+ </tr>
302
+ <tr width="33.333333333333336%">
326
303
  <td align="center" width="33.333333333333336%">
327
304
  <a
328
- href="https://www.jbo579.com/th/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
305
+ href="https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&amp;utm_medium=referral&amp;utm_campaign=nes-for-axios_global&amp;utm_content=landing-page_none_20260924_a"
329
306
  style="padding: 10px; display: inline-block"
330
307
  target="_blank"
331
308
  >
332
309
  <img
333
- width="71px"
334
- height="70px"
335
- src="https://images.opencollective.com/jbo-thailand/d17e84f/avatar.png"
336
- alt="JBO Thailand"
310
+ width="180px"
311
+ height="53px"
312
+ src="https://axios.rest/sponsors/herodevs.svg"
313
+ alt="HeroDevs"
337
314
  />
338
315
  </a>
339
316
  <p
340
317
  align="center"
341
318
  >
342
- JBO Thailand is a prominent online entertainment brand in Thailand, offering sports betting, esports, online casino games, and a wide range of other exciting games.
319
+ Security and long-term support for end-of-life open source software.
343
320
  </p>
344
321
  <p align="center">
345
322
  <a
346
- href="https://www.jbo579.com/th/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
323
+ href="https://www.herodevs.com/support/nes-for-axios?utm_source=axios-site&amp;utm_medium=referral&amp;utm_campaign=nes-for-axios_global&amp;utm_content=landing-page_none_20260924_a"
347
324
  target="_blank"
348
- ><b>jbo88b.com</b></a
325
+ ><b>herodevs.com</b></a
349
326
  >
350
327
  </p>
351
328
  </td>
352
329
  <td align="center" width="33.333333333333336%">
353
330
  <a
354
- href="https://opencollective.com/axios/contribute"
331
+ href="https://opencollective.com/sweepico-promo-code"
332
+ style="padding: 10px; display: inline-block"
355
333
  target="_blank"
356
- >πŸ’œ Become a sponsor</a
357
334
  >
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"
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>
358
354
  </td>
359
355
  </tr>
360
356
  </table>
@@ -536,13 +532,13 @@ const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundl
536
532
  Using jsDelivr CDN (ES5 UMD browser module):
537
533
 
538
534
  ```html
539
- <script src="https://cdn.jsdelivr.net/npm/axios@1.13.2/dist/axios.min.js"></script>
535
+ <script src="https://cdn.jsdelivr.net/npm/axios@1.20.0/dist/axios.min.js"></script>
540
536
  ```
541
537
 
542
538
  Using unpkg CDN:
543
539
 
544
540
  ```html
545
- <script src="https://unpkg.com/axios@1.13.2/dist/axios.min.js"></script>
541
+ <script src="https://unpkg.com/axios@1.20.0/dist/axios.min.js"></script>
546
542
  ```
547
543
 
548
544
  ## Example
@@ -648,6 +644,7 @@ axios({
648
644
 
649
645
  ```js
650
646
  // GET request for remote image in node.js
647
+ import fs from 'fs';
651
648
  const response = await axios({
652
649
  method: 'get',
653
650
  url: 'https://bit.ly/2mTM3nY',
@@ -763,6 +760,8 @@ These config options are available for requests. Only `url` is required. Request
763
760
  // `baseURL` is not a security boundary. If `url` is attacker-controlled, validate it
764
761
  // before passing it to axios. Relative URLs can contain `..` segments that resolve
765
762
  // outside an intended path prefix after the final URL is parsed.
763
+ // HTTP(S) URLs must include `//` after the protocol. Values such as
764
+ // `https:example.com` and `https:/example.com` are rejected with ERR_INVALID_URL.
766
765
  baseURL: 'https://some-domain.com/api/',
767
766
 
768
767
  // `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
@@ -1371,6 +1370,40 @@ axios.interceptors.request.use(
1371
1370
  );
1372
1371
  ```
1373
1372
 
1373
+ If a synchronous request interceptor throws, Axios calls that interceptor's paired rejection handler and stops running the remaining request interceptors. A rejection handler that returns normally, including one that returns `undefined` or a fulfilled Promise, treats the error as handled: Axios dispatches the request with the last valid config, and ignores the handler's return value. To block dispatch, omit the rejection handler or throw/return a rejected Promise from it. The final error then continues through response rejection interceptors.
1374
+
1375
+ Use a rejected Promise when validation must prevent the request:
1376
+
1377
+ ```js
1378
+ axios.interceptors.request.use(
1379
+ function validate(config) {
1380
+ if (!config.headers.has('Authorization')) {
1381
+ throw new Error('Authorization is required');
1382
+ }
1383
+ return config;
1384
+ },
1385
+ function rejectInvalidRequest(error) {
1386
+ return Promise.reject(error);
1387
+ },
1388
+ { synchronous: true }
1389
+ );
1390
+ ```
1391
+
1392
+ A logging-only rejection handler can return normally to preserve the existing request-continuation behavior:
1393
+
1394
+ ```js
1395
+ axios.interceptors.request.use(
1396
+ function prepare(config) {
1397
+ throw new Error('Optional preparation failed');
1398
+ },
1399
+ function logPreparationFailure(error) {
1400
+ console.warn(error);
1401
+ // Returning normally dispatches with the last valid config.
1402
+ },
1403
+ { synchronous: true }
1404
+ );
1405
+ ```
1406
+
1374
1407
  If you want to execute a particular interceptor based on a runtime check,
1375
1408
  you can add a `runWhen` function to the options object. The request interceptor will not run **if and only if** the return
1376
1409
  of `runWhen` is `false`. Axios calls the function with the config
@@ -1438,7 +1471,7 @@ When a response is fulfilled and multiple response interceptors are registered:
1438
1471
  - If a fulfillment interceptor throws, Axios skips the next fulfillment interceptor and calls the next rejection interceptor.
1439
1472
  - After the error is caught, later fulfillment interceptors run again, just like in a promise chain.
1440
1473
 
1441
- Read [the interceptor tests](./test/specs/interceptors.spec.js) to see all this in code.
1474
+ Read [the interceptor tests](./tests/browser/interceptors.browser.test.js) to see all this in code.
1442
1475
 
1443
1476
  ## Error types
1444
1477
 
@@ -1496,6 +1529,10 @@ axios.get('/user/12345').catch(function (error) {
1496
1529
  });
1497
1530
  ```
1498
1531
 
1532
+ Axios rejects an `http:` or `https:` request `url` or `baseURL` that omits `//` after the protocol. For example, `https:example.com` and `https:/example.com` reject with `AxiosError` code `ERR_INVALID_URL` instead of being silently normalized. Pass a well-formed URL such as `https://example.com`.
1533
+
1534
+ The error identifies the malformed URL, for example `Invalid URL "https:example.com": missing "//" after protocol`. To keep logs useful without leaking secrets, Axios reports the control-character-normalized URL with credentials, query parameter values, and fragment contents redacted; the scheme, host, path, and query parameter names remain visible.
1535
+
1499
1536
  Use `validateStatus` to override the default condition (`status >= 200 && status < 300`) and choose which HTTP status codes should reject.
1500
1537
 
1501
1538
  ```js
@@ -1931,6 +1968,24 @@ formData.append('users[1][surname]', 'Anderson');
1931
1968
  formData.append('obj2{}', '[{"x":1}]');
1932
1969
  ```
1933
1970
 
1971
+ ### Converting FormData to JSON
1972
+
1973
+ `axios.formToJSON()` converts `FormData` field names that use dot or bracket notation into nested objects and arrays. Only `.`, `[`, and `]` are structural separators. Other characters, including `-`, spaces, `+`, `*`, and `&`, remain part of the literal key.
1974
+
1975
+ ```js
1976
+ const form = new FormData();
1977
+ form.append('user-name', 'johndoe');
1978
+ form.append('user.name', 'john');
1979
+
1980
+ console.log(axios.formToJSON(form));
1981
+ // {
1982
+ // 'user-name': 'johndoe',
1983
+ // user: { name: 'john' }
1984
+ // }
1985
+ ```
1986
+
1987
+ `user[name]` also creates `{ user: { name: ... } }`, while `items[]` creates an array.
1988
+
1934
1989
  Axios supports `postForm`, `putForm`, and `patchForm` as shortcuts for the matching HTTP methods with the `Content-Type` header preset to `multipart/form-data`.
1935
1990
 
1936
1991
  ## Posting files
@@ -2004,10 +2059,9 @@ submits this JSON object:
2004
2059
  {
2005
2060
  "foo": "1",
2006
2061
  "deep": {
2007
- "prop": {
2008
- "spaced": "3"
2009
- }
2062
+ "prop": "2"
2010
2063
  },
2064
+ "deep prop spaced": "3",
2011
2065
  "baz": [
2012
2066
  "4",
2013
2067
  "5"
@@ -2018,6 +2072,8 @@ submits this JSON object:
2018
2072
  }
2019
2073
  ```
2020
2074
 
2075
+ Only dot and bracket notation create nested paths when a form is converted to JSON. Spaces and other punctuation remain part of literal field names.
2076
+
2021
2077
  Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
2022
2078
 
2023
2079
  ## Progress capturing
@@ -2246,8 +2302,9 @@ Returns `this`.
2246
2302
  ### AxiosHeaders#get(header)
2247
2303
 
2248
2304
  ```
2249
- get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue;
2305
+ get(headerName: string, parser: typeof AxiosHeaders.parseParameters): AxiosHeaderParameters;
2250
2306
  get(headerName: string, parser: RegExp): RegExpExecArray | null;
2307
+ get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
2251
2308
  ```
2252
2309
 
2253
2310
  Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`,
@@ -2267,6 +2324,15 @@ console.log(headers.get('Content-Type', true)); // parse key-value pairs from a
2267
2324
  // boundary: 'Asrf456BGe4h'
2268
2325
  // }
2269
2326
 
2327
+ const quotedHeaders = new AxiosHeaders({
2328
+ 'Content-Type': 'multipart/form-data; boundary="a,b"',
2329
+ });
2330
+
2331
+ console.log({
2332
+ ...quotedHeaders.get('Content-Type', AxiosHeaders.parseParameters),
2333
+ });
2334
+ // { boundary: 'a,b' }
2335
+
2270
2336
  console.log(
2271
2337
  headers.get('Content-Type', (value, name, headers) => {
2272
2338
  return String(value).replace(/a/g, 'ZZZ');
@@ -2278,6 +2344,10 @@ console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]);
2278
2344
  // boundary=Asrf456BGe4h
2279
2345
  ```
2280
2346
 
2347
+ `AxiosHeaders.parseParameters` is the opt-in parser for normalized HTTP parameter values. It returns a null-prototype map, matches parameter names case-insensitively, removes quoted-string delimiters, decodes escaped quotes and backslashes, preserves commas and semicolons inside quoted values, and removes only HTTP optional whitespace around unquoted values. It omits the unsafe keys `__proto__`, `constructor`, and `prototype`.
2348
+
2349
+ Passing `true` remains the legacy tokenizer and keeps its existing output for backward compatibility.
2350
+
2281
2351
  Returns the value of the header.
2282
2352
 
2283
2353
  ### AxiosHeaders#has(header, matcher?)
@@ -2562,6 +2632,99 @@ try {
2562
2632
  }
2563
2633
  ```
2564
2634
 
2635
+ ### Typing request data and query params
2636
+
2637
+ `AxiosRequestConfig<D = any, P = any>` uses `D` for the request body and `P` for query parameters. The params serializer receives the same `P`, and both types are preserved on the default response config:
2638
+
2639
+ ```typescript
2640
+ import axios, {
2641
+ type AxiosPromise,
2642
+ type AxiosRequestConfig,
2643
+ type InternalAxiosRequestConfig,
2644
+ } from 'axios';
2645
+
2646
+ interface RequestBody {
2647
+ includeArchived: boolean;
2648
+ }
2649
+
2650
+ interface SearchParams {
2651
+ query: string;
2652
+ page?: number;
2653
+ }
2654
+
2655
+ interface SearchResponse {
2656
+ results: string[];
2657
+ }
2658
+
2659
+ const config: AxiosRequestConfig<RequestBody, SearchParams> = {
2660
+ data: { includeArchived: false },
2661
+ params: { query: 'axios', page: 1 },
2662
+ paramsSerializer: (params) => `${params.query}:${params.page ?? 1}`,
2663
+ };
2664
+
2665
+ const response = await axios.get('/search', config);
2666
+ response.config.data; // RequestBody | undefined
2667
+ response.config.params; // SearchParams | undefined
2668
+
2669
+ const invalidConfig: AxiosRequestConfig<RequestBody, SearchParams> = {
2670
+ // @ts-expect-error `query` must be a string
2671
+ params: { query: 123 },
2672
+ };
2673
+
2674
+ const adapter = (
2675
+ adapterConfig: InternalAxiosRequestConfig<RequestBody, SearchParams>
2676
+ ): AxiosPromise<SearchResponse, RequestBody, SearchParams> =>
2677
+ Promise.resolve({
2678
+ data: { results: [] },
2679
+ status: 200,
2680
+ statusText: 'OK',
2681
+ headers: {},
2682
+ config: adapterConfig,
2683
+ });
2684
+ ```
2685
+
2686
+ The request methods place `P` lastβ€”`<T, R, D, P>`β€”so the existing response data (`T`), custom response (`R`), and request data (`D`) positions do not change. Explicit custom response types still determine the resolved value. `RawAxiosRequestConfig`, `InternalAxiosRequestConfig`, defaults, `AxiosResponse`, `AxiosPromise<T, D, P>`, `AxiosError`, `CanceledError`, callable instances, adapters, and `mergeConfig()` also carry `P`. The default is `any` for backward compatibility.
2687
+
2688
+ Use all three public error generics when cancellation narrowing must retain the response, request body, and params types:
2689
+
2690
+ ```typescript
2691
+ declare const error: unknown;
2692
+
2693
+ if (axios.isCancel<SearchResponse, RequestBody, SearchParams>(error)) {
2694
+ error.config?.data; // RequestBody | undefined
2695
+ error.config?.params; // SearchParams | undefined
2696
+ }
2697
+ ```
2698
+
2699
+ ### Symbol-keyed custom request config
2700
+
2701
+ Own enumerable symbol properties survive config merging, so module-augmented options can reach request interceptors and adapters:
2702
+
2703
+ ```typescript
2704
+ import axios from 'axios';
2705
+
2706
+ export const someFlag: unique symbol = Symbol(
2707
+ 'some flag used in request interceptor'
2708
+ );
2709
+
2710
+ declare module 'axios' {
2711
+ interface AxiosRequestConfig<D = any, P = any> {
2712
+ [someFlag]?: boolean;
2713
+ }
2714
+ }
2715
+
2716
+ axios.interceptors.request.use((config) => {
2717
+ if (config[someFlag]) {
2718
+ config.headers.set('X-Some-Flag', 'enabled');
2719
+ }
2720
+ return config;
2721
+ });
2722
+
2723
+ await axios.get('/users', { [someFlag]: true });
2724
+ ```
2725
+
2726
+ Only own enumerable symbol properties are copied; inherited and non-enumerable symbol properties are not.
2727
+
2565
2728
  Because axios publishes an ESM default export and a CJS `module.exports`, TypeScript has a few caveats.
2566
2729
  The recommended setting is `"moduleResolution": "node16"`, which is implied by `"module": "node16"`. This requires TypeScript 4.7 or greater.
2567
2730
  If you use ESM, your settings should be fine.