axios 1.5.1 → 1.6.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/CHANGELOG.md +162 -0
- package/README.md +256 -1
- package/dist/axios.js +4 -3
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +4 -4
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +4 -4
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +27 -14
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +18 -7
- package/index.d.ts +19 -8
- package/lib/adapters/http.js +23 -10
- package/lib/adapters/xhr.js +2 -2
- package/lib/env/data.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# [1.6.0](https://github.com/axios/axios/compare/v1.5.1...v1.6.0) (2023-10-26)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **CSRF:** fixed CSRF vulnerability CVE-2023-45857 ([#6028](https://github.com/axios/axios/issues/6028)) ([96ee232](https://github.com/axios/axios/commit/96ee232bd3ee4de2e657333d4d2191cd389e14d0))
|
9
|
+
* **dns:** fixed lookup function decorator to work properly in node v20; ([#6011](https://github.com/axios/axios/issues/6011)) ([5aaff53](https://github.com/axios/axios/commit/5aaff532a6b820bb9ab6a8cd0f77131b47e2adb8))
|
10
|
+
* **types:** fix AxiosHeaders types; ([#5931](https://github.com/axios/axios/issues/5931)) ([a1c8ad0](https://github.com/axios/axios/commit/a1c8ad008b3c13d53e135bbd0862587fb9d3fc09))
|
11
|
+
|
12
|
+
### PRs
|
13
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
14
|
+
```
|
15
|
+
|
16
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
17
|
+
```
|
18
|
+
|
19
|
+
### Contributors to this release
|
20
|
+
|
21
|
+
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+449/-114 (#6032 #6021 #6011 #5932 #5931 )")
|
22
|
+
- <img src="https://avatars.githubusercontent.com/u/63700910?v=4&s=18" alt="avatar" width="18"/> [Valentin Panov](https://github.com/valentin-panov "+4/-4 (#6028 )")
|
23
|
+
- <img src="https://avatars.githubusercontent.com/u/76877078?v=4&s=18" alt="avatar" width="18"/> [Rinku Chaudhari](https://github.com/therealrinku "+1/-1 (#5889 )")
|
24
|
+
|
3
25
|
## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26)
|
4
26
|
|
5
27
|
|
@@ -19,6 +41,13 @@
|
|
19
41
|
- <img src="https://avatars.githubusercontent.com/u/132928043?v=4&s=18" alt="avatar" width="18"/> [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki "+2/-1 (#5892 )")
|
20
42
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+1/-1 ()")
|
21
43
|
|
44
|
+
### PRs
|
45
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
46
|
+
```
|
47
|
+
|
48
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
49
|
+
```
|
50
|
+
|
22
51
|
# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26)
|
23
52
|
|
24
53
|
|
@@ -42,6 +71,13 @@
|
|
42
71
|
- <img src="https://avatars.githubusercontent.com/u/65978976?v=4&s=18" alt="avatar" width="18"/> [Jonathan Budiman](https://github.com/JBudiman00 "+30/-0 (#5788 )")
|
43
72
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+3/-5 (#5791 )")
|
44
73
|
|
74
|
+
### PRs
|
75
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
76
|
+
```
|
77
|
+
|
78
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
79
|
+
```
|
80
|
+
|
45
81
|
# [1.4.0](https://github.com/axios/axios/compare/v1.3.6...v1.4.0) (2023-04-27)
|
46
82
|
|
47
83
|
|
@@ -67,6 +103,13 @@
|
|
67
103
|
- <img src="https://avatars.githubusercontent.com/u/47537704?v=4&s=18" alt="avatar" width="18"/> [Arthur Fiorette](https://github.com/arthurfiorette "+19/-19 (#5525 )")
|
68
104
|
- <img src="https://avatars.githubusercontent.com/u/43876655?v=4&s=18" alt="avatar" width="18"/> [PIYUSH NEGI](https://github.com/npiyush97 "+2/-18 (#5670 )")
|
69
105
|
|
106
|
+
### PRs
|
107
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
108
|
+
```
|
109
|
+
|
110
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
111
|
+
```
|
112
|
+
|
70
113
|
## [1.3.6](https://github.com/axios/axios/compare/v1.3.5...v1.3.6) (2023-04-19)
|
71
114
|
|
72
115
|
|
@@ -80,6 +123,13 @@
|
|
80
123
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+48/-10 (#5665 #5661 #5663 )")
|
81
124
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+2/-0 (#5445 )")
|
82
125
|
|
126
|
+
### PRs
|
127
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
128
|
+
```
|
129
|
+
|
130
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
131
|
+
```
|
132
|
+
|
83
133
|
## [1.3.5](https://github.com/axios/axios/compare/v1.3.4...v1.3.5) (2023-04-05)
|
84
134
|
|
85
135
|
|
@@ -92,6 +142,13 @@
|
|
92
142
|
|
93
143
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+28/-10 (#5633 #5584 )")
|
94
144
|
|
145
|
+
### PRs
|
146
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
147
|
+
```
|
148
|
+
|
149
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
150
|
+
```
|
151
|
+
|
95
152
|
## [1.3.4](https://github.com/axios/axios/compare/v1.3.3...v1.3.4) (2023-02-22)
|
96
153
|
|
97
154
|
|
@@ -106,6 +163,13 @@
|
|
106
163
|
- <img src="https://avatars.githubusercontent.com/u/19550000?v=4&s=18" alt="avatar" width="18"/> [lcysgsg](https://github.com/lcysgsg "+4/-0 (#5548 )")
|
107
164
|
- <img src="https://avatars.githubusercontent.com/u/5492927?v=4&s=18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+3/-0 (#5444 )")
|
108
165
|
|
166
|
+
### PRs
|
167
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
168
|
+
```
|
169
|
+
|
170
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
171
|
+
```
|
172
|
+
|
109
173
|
## [1.3.3](https://github.com/axios/axios/compare/v1.3.2...v1.3.3) (2023-02-13)
|
110
174
|
|
111
175
|
|
@@ -120,6 +184,13 @@
|
|
120
184
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+11/-7 (#5545 #5535 #5542 )")
|
121
185
|
- <img src="https://avatars.githubusercontent.com/u/19842213?v=4&s=18" alt="avatar" width="18"/> [陈若枫](https://github.com/ruofee "+2/-2 (#5467 )")
|
122
186
|
|
187
|
+
### PRs
|
188
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
189
|
+
```
|
190
|
+
|
191
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
192
|
+
```
|
193
|
+
|
123
194
|
## [1.3.2](https://github.com/axios/axios/compare/v1.3.1...v1.3.2) (2023-02-03)
|
124
195
|
|
125
196
|
|
@@ -132,6 +203,13 @@
|
|
132
203
|
|
133
204
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+2/-1 (#5530 #5528 )")
|
134
205
|
|
206
|
+
### PRs
|
207
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
208
|
+
```
|
209
|
+
|
210
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
211
|
+
```
|
212
|
+
|
135
213
|
## [1.3.1](https://github.com/axios/axios/compare/v1.3.0...v1.3.1) (2023-02-01)
|
136
214
|
|
137
215
|
|
@@ -144,6 +222,13 @@
|
|
144
222
|
|
145
223
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-8 (#5521 #5518 )")
|
146
224
|
|
225
|
+
### PRs
|
226
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
227
|
+
```
|
228
|
+
|
229
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
230
|
+
```
|
231
|
+
|
147
232
|
# [1.3.0](https://github.com/axios/axios/compare/v1.2.6...v1.3.0) (2023-01-31)
|
148
233
|
|
149
234
|
|
@@ -162,6 +247,13 @@
|
|
162
247
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )")
|
163
248
|
- <img src="https://avatars.githubusercontent.com/u/35015993?v=4&s=18" alt="avatar" width="18"/> [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )")
|
164
249
|
|
250
|
+
### PRs
|
251
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
252
|
+
```
|
253
|
+
|
254
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
255
|
+
```
|
256
|
+
|
165
257
|
## [1.2.6](https://github.com/axios/axios/compare/v1.2.5...v1.2.6) (2023-01-28)
|
166
258
|
|
167
259
|
|
@@ -174,6 +266,13 @@
|
|
174
266
|
|
175
267
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )")
|
176
268
|
|
269
|
+
### PRs
|
270
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
271
|
+
```
|
272
|
+
|
273
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
274
|
+
```
|
275
|
+
|
177
276
|
## [1.2.5](https://github.com/axios/axios/compare/v1.2.4...v1.2.5) (2023-01-26)
|
178
277
|
|
179
278
|
|
@@ -186,6 +285,13 @@
|
|
186
285
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+82/-54 (#5499 )")
|
187
286
|
-  [Elliot Ford](https://github.com/EFord36 "+1/-1 (#5462 )")
|
188
287
|
|
288
|
+
### PRs
|
289
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
290
|
+
```
|
291
|
+
|
292
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
293
|
+
```
|
294
|
+
|
189
295
|
## [1.2.4](https://github.com/axios/axios/compare/v1.2.3...v1.2.4) (2023-01-22)
|
190
296
|
|
191
297
|
|
@@ -199,6 +305,13 @@
|
|
199
305
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+242/-108 (#5486 #5482 )")
|
200
306
|
-  [Daniel Hillmann](https://github.com/hilleer "+1/-1 (#5478 )")
|
201
307
|
|
308
|
+
### PRs
|
309
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
310
|
+
```
|
311
|
+
|
312
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
313
|
+
```
|
314
|
+
|
202
315
|
## [1.2.3](https://github.com/axios/axios/compare/1.2.2...1.2.3) (2023-01-10)
|
203
316
|
|
204
317
|
|
@@ -210,6 +323,13 @@
|
|
210
323
|
|
211
324
|
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )")
|
212
325
|
|
326
|
+
### PRs
|
327
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
328
|
+
```
|
329
|
+
|
330
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
331
|
+
```
|
332
|
+
|
213
333
|
## [1.2.2] - 2022-12-29
|
214
334
|
|
215
335
|
### Fixed
|
@@ -264,6 +384,13 @@
|
|
264
384
|
- [Ivan Barsukov](https://github.com/ovarn)
|
265
385
|
- [Arthur Fiorette](https://github.com/arthurfiorette)
|
266
386
|
|
387
|
+
### PRs
|
388
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
389
|
+
```
|
390
|
+
|
391
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
392
|
+
```
|
393
|
+
|
267
394
|
## [1.2.0] - 2022-11-10
|
268
395
|
|
269
396
|
### Changed
|
@@ -330,6 +457,13 @@
|
|
330
457
|
- [AZM](https://github.com/aziyatali)
|
331
458
|
- [relbns](https://github.com/relbns)
|
332
459
|
|
460
|
+
### PRs
|
461
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
462
|
+
```
|
463
|
+
|
464
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
465
|
+
```
|
466
|
+
|
333
467
|
## [1.1.3] - 2022-10-15
|
334
468
|
|
335
469
|
### Added
|
@@ -364,6 +498,13 @@
|
|
364
498
|
- [littledian](https://github.com/littledian)
|
365
499
|
- [ChronosMasterOfAllTime](https://github.com/ChronosMasterOfAllTime)
|
366
500
|
|
501
|
+
### PRs
|
502
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
503
|
+
```
|
504
|
+
|
505
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
506
|
+
```
|
507
|
+
|
367
508
|
## [1.1.2] - 2022-10-07
|
368
509
|
|
369
510
|
### Fixed
|
@@ -374,6 +515,13 @@
|
|
374
515
|
|
375
516
|
- [Jason Saayman](https://github.com/jasonsaayman)
|
376
517
|
|
518
|
+
### PRs
|
519
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
520
|
+
```
|
521
|
+
|
522
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
523
|
+
```
|
524
|
+
|
377
525
|
## [1.1.1] - 2022-10-07
|
378
526
|
|
379
527
|
### Fixed
|
@@ -384,6 +532,13 @@
|
|
384
532
|
|
385
533
|
- [Jason Saayman](https://github.com/jasonsaayman)
|
386
534
|
|
535
|
+
### PRs
|
536
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
537
|
+
```
|
538
|
+
|
539
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
540
|
+
```
|
541
|
+
|
387
542
|
## [1.1.0] - 2022-10-06
|
388
543
|
|
389
544
|
### Fixed
|
@@ -403,6 +558,13 @@
|
|
403
558
|
- [Ivan Pepelko](https://github.com/ivanpepelko)
|
404
559
|
- [Richard Kořínek](https://github.com/risa)
|
405
560
|
|
561
|
+
### PRs
|
562
|
+
- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) )
|
563
|
+
```
|
564
|
+
|
565
|
+
⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
|
566
|
+
```
|
567
|
+
|
406
568
|
## [1.0.0] - 2022-10-04
|
407
569
|
|
408
570
|
### Added
|
package/README.md
CHANGED
@@ -66,6 +66,7 @@
|
|
66
66
|
- [HTML Form Posting](#-html-form-posting-browser)
|
67
67
|
- [🆕 Progress capturing](#-progress-capturing)
|
68
68
|
- [🆕 Rate limiting](#-progress-capturing)
|
69
|
+
- [🆕 AxiosHeaders](#-axiosheaders)
|
69
70
|
- [Semver](#semver)
|
70
71
|
- [Promises](#promises)
|
71
72
|
- [TypeScript](#typescript)
|
@@ -1270,7 +1271,7 @@ const {data} = await axios.post(SERVER_URL, readableStream, {
|
|
1270
1271
|
````
|
1271
1272
|
|
1272
1273
|
> **Note:**
|
1273
|
-
> Capturing FormData upload progress is
|
1274
|
+
> Capturing FormData upload progress is not currently supported in node.js environments.
|
1274
1275
|
|
1275
1276
|
> **⚠️ Warning**
|
1276
1277
|
> It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment,
|
@@ -1291,6 +1292,260 @@ const {data} = await axios.post(LOCAL_SERVER_URL, myBuffer, {
|
|
1291
1292
|
});
|
1292
1293
|
```
|
1293
1294
|
|
1295
|
+
## 🆕 AxiosHeaders
|
1296
|
+
|
1297
|
+
Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work.
|
1298
|
+
Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons
|
1299
|
+
and for a workaround when servers mistakenly consider the header's case.
|
1300
|
+
The old approach of directly manipulating headers object is still available, but deprecated and not recommended for future usage.
|
1301
|
+
|
1302
|
+
### Working with headers
|
1303
|
+
|
1304
|
+
An AxiosHeaders object instance can contain different types of internal values. that control setting and merging logic.
|
1305
|
+
The final headers object with string values is obtained by Axios by calling the `toJSON` method.
|
1306
|
+
|
1307
|
+
> Note: By JSON here we mean an object consisting only of string values intended to be sent over the network.
|
1308
|
+
|
1309
|
+
The header value can be one of the following types:
|
1310
|
+
- `string` - normal string value that will be sent to the server
|
1311
|
+
- `null` - skip header when rendering to JSON
|
1312
|
+
- `false` - skip header when rendering to JSON, additionally indicates that `set` method must be called with `rewrite` option set to `true`
|
1313
|
+
to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`)
|
1314
|
+
- `undefined` - value is not set
|
1315
|
+
|
1316
|
+
> Note: The header value is considered set if it is not equal to undefined.
|
1317
|
+
|
1318
|
+
The headers object is always initialized inside interceptors and transformers:
|
1319
|
+
|
1320
|
+
```ts
|
1321
|
+
axios.interceptors.request.use((request: InternalAxiosRequestConfig) => {
|
1322
|
+
request.headers.set('My-header', 'value');
|
1323
|
+
|
1324
|
+
request.headers.set({
|
1325
|
+
"My-set-header1": "my-set-value1",
|
1326
|
+
"My-set-header2": "my-set-value2"
|
1327
|
+
});
|
1328
|
+
|
1329
|
+
request.headers.set('User-Agent', false); // disable subsequent setting the header by Axios
|
1330
|
+
|
1331
|
+
request.headers.setContentType('text/plain');
|
1332
|
+
|
1333
|
+
request.headers['My-set-header2'] = 'newValue' // direct access is deprecated
|
1334
|
+
|
1335
|
+
return request;
|
1336
|
+
}
|
1337
|
+
);
|
1338
|
+
````
|
1339
|
+
|
1340
|
+
You can iterate over an `AxiosHeaders` instance using a `for...of` statement:
|
1341
|
+
|
1342
|
+
````js
|
1343
|
+
const headers = new AxiosHeaders({
|
1344
|
+
foo: '1',
|
1345
|
+
bar: '2',
|
1346
|
+
baz: '3'
|
1347
|
+
});
|
1348
|
+
|
1349
|
+
for(const [header, value] of headers) {
|
1350
|
+
console.log(header, value);
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
// foo 1
|
1354
|
+
// bar 2
|
1355
|
+
// baz 3
|
1356
|
+
````
|
1357
|
+
|
1358
|
+
### new AxiosHeaders(headers?)
|
1359
|
+
|
1360
|
+
Constructs a new `AxiosHeaders` instance.
|
1361
|
+
|
1362
|
+
```
|
1363
|
+
constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
|
1364
|
+
```
|
1365
|
+
|
1366
|
+
If the headers object is a string, it will be parsed as RAW HTTP headers.
|
1367
|
+
|
1368
|
+
````js
|
1369
|
+
const headers = new AxiosHeaders(`
|
1370
|
+
Host: www.bing.com
|
1371
|
+
User-Agent: curl/7.54.0
|
1372
|
+
Accept: */*`);
|
1373
|
+
|
1374
|
+
console.log(headers);
|
1375
|
+
|
1376
|
+
// Object [AxiosHeaders] {
|
1377
|
+
// host: 'www.bing.com',
|
1378
|
+
// 'user-agent': 'curl/7.54.0',
|
1379
|
+
// accept: '*/*'
|
1380
|
+
// }
|
1381
|
+
````
|
1382
|
+
|
1383
|
+
### AxiosHeaders#set
|
1384
|
+
|
1385
|
+
```ts
|
1386
|
+
set(headerName, value: Axios, rewrite?: boolean);
|
1387
|
+
set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean);
|
1388
|
+
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
|
1389
|
+
```
|
1390
|
+
|
1391
|
+
The `rewrite` argument controls the overwriting behavior:
|
1392
|
+
- `false` - do not overwrite if header's value is set (is not `undefined`)
|
1393
|
+
- `undefined` (default) - overwrite the header unless its value is set to `false`
|
1394
|
+
- `true` - rewrite anyway
|
1395
|
+
|
1396
|
+
The option can also accept a user-defined function that determines whether the value should be overwritten or not.
|
1397
|
+
|
1398
|
+
Returns `this`.
|
1399
|
+
|
1400
|
+
### AxiosHeaders#get(header)
|
1401
|
+
|
1402
|
+
```
|
1403
|
+
get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue;
|
1404
|
+
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
1405
|
+
````
|
1406
|
+
|
1407
|
+
Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`,
|
1408
|
+
matcher function or internal key-value parser.
|
1409
|
+
|
1410
|
+
```ts
|
1411
|
+
const headers = new AxiosHeaders({
|
1412
|
+
'Content-Type': 'multipart/form-data; boundary=Asrf456BGe4h'
|
1413
|
+
});
|
1414
|
+
|
1415
|
+
console.log(headers.get('Content-Type'));
|
1416
|
+
// multipart/form-data; boundary=Asrf456BGe4h
|
1417
|
+
|
1418
|
+
console.log(headers.get('Content-Type', true)); // parse key-value pairs from a string separated with \s,;= delimiters:
|
1419
|
+
// [Object: null prototype] {
|
1420
|
+
// 'multipart/form-data': undefined,
|
1421
|
+
// boundary: 'Asrf456BGe4h'
|
1422
|
+
// }
|
1423
|
+
|
1424
|
+
|
1425
|
+
console.log(headers.get('Content-Type', (value, name, headers) => {
|
1426
|
+
return String(value).replace(/a/g, 'ZZZ');
|
1427
|
+
}));
|
1428
|
+
// multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h
|
1429
|
+
|
1430
|
+
console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]);
|
1431
|
+
// boundary=Asrf456BGe4h
|
1432
|
+
|
1433
|
+
```
|
1434
|
+
|
1435
|
+
Returns the value of the header.
|
1436
|
+
|
1437
|
+
### AxiosHeaders#has(header, matcher?)
|
1438
|
+
|
1439
|
+
```
|
1440
|
+
has(header: string, matcher?: AxiosHeaderMatcher): boolean;
|
1441
|
+
```
|
1442
|
+
|
1443
|
+
Returns `true` if the header is set (has no `undefined` value).
|
1444
|
+
|
1445
|
+
### AxiosHeaders#delete(header, matcher?)
|
1446
|
+
|
1447
|
+
```
|
1448
|
+
delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
|
1449
|
+
```
|
1450
|
+
|
1451
|
+
Returns `true` if at least one header has been removed.
|
1452
|
+
|
1453
|
+
### AxiosHeaders#clear(matcher?)
|
1454
|
+
|
1455
|
+
```
|
1456
|
+
clear(matcher?: AxiosHeaderMatcher): boolean;
|
1457
|
+
```
|
1458
|
+
|
1459
|
+
Removes all headers.
|
1460
|
+
Unlike the `delete` method matcher, this optional matcher will be used to match against the header name rather than the value.
|
1461
|
+
|
1462
|
+
```ts
|
1463
|
+
const headers = new AxiosHeaders({
|
1464
|
+
'foo': '1',
|
1465
|
+
'x-foo': '2',
|
1466
|
+
'x-bar': '3',
|
1467
|
+
});
|
1468
|
+
|
1469
|
+
console.log(headers.clear(/^x-/)); // true
|
1470
|
+
|
1471
|
+
console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' }
|
1472
|
+
```
|
1473
|
+
|
1474
|
+
Returns `true` if at least one header has been cleared.
|
1475
|
+
|
1476
|
+
### AxiosHeaders#normalize(format);
|
1477
|
+
|
1478
|
+
If the headers object was changed directly, it can have duplicates with the same name but in different cases.
|
1479
|
+
This method normalizes the headers object by combining duplicate keys into one.
|
1480
|
+
Axios uses this method internally after calling each interceptor.
|
1481
|
+
Set `format` to true for converting headers name to lowercase and capitalize the initial letters (`cOntEnt-type` => `Content-Type`)
|
1482
|
+
|
1483
|
+
```js
|
1484
|
+
const headers = new AxiosHeaders({
|
1485
|
+
'foo': '1',
|
1486
|
+
});
|
1487
|
+
|
1488
|
+
headers.Foo = '2';
|
1489
|
+
headers.FOO = '3';
|
1490
|
+
|
1491
|
+
console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' }
|
1492
|
+
console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' }
|
1493
|
+
console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' }
|
1494
|
+
```
|
1495
|
+
|
1496
|
+
Returns `this`.
|
1497
|
+
|
1498
|
+
### AxiosHeaders#concat(...targets)
|
1499
|
+
|
1500
|
+
```
|
1501
|
+
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
1502
|
+
```
|
1503
|
+
|
1504
|
+
Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, it will be parsed as RAW HTTP headers.
|
1505
|
+
|
1506
|
+
Returns a new `AxiosHeaders` instance.
|
1507
|
+
|
1508
|
+
### AxiosHeaders#toJSON(asStrings?)
|
1509
|
+
|
1510
|
+
````
|
1511
|
+
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
1512
|
+
````
|
1513
|
+
|
1514
|
+
Resolve all internal headers values into a new null prototype object.
|
1515
|
+
Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
|
1516
|
+
|
1517
|
+
### AxiosHeaders.from(thing?)
|
1518
|
+
|
1519
|
+
````
|
1520
|
+
from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
1521
|
+
````
|
1522
|
+
|
1523
|
+
Returns a new `AxiosHeaders` instance created from the raw headers passed in,
|
1524
|
+
or simply returns the given headers object if it's an `AxiosHeaders` instance.
|
1525
|
+
|
1526
|
+
### AxiosHeaders.concat(...targets)
|
1527
|
+
|
1528
|
+
````
|
1529
|
+
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
1530
|
+
````
|
1531
|
+
|
1532
|
+
Returns a new `AxiosHeaders` instance created by merging the target objects.
|
1533
|
+
|
1534
|
+
### Shortcuts
|
1535
|
+
|
1536
|
+
The following shortcuts are available:
|
1537
|
+
|
1538
|
+
- `setContentType`, `getContentType`, `hasContentType`
|
1539
|
+
|
1540
|
+
- `setContentLength`, `getContentLength`, `hasContentLength`
|
1541
|
+
|
1542
|
+
- `setAccept`, `getAccept`, `hasAccept`
|
1543
|
+
|
1544
|
+
- `setUserAgent`, `getUserAgent`, `hasUserAgent`
|
1545
|
+
|
1546
|
+
- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
|
1547
|
+
|
1548
|
+
|
1294
1549
|
## Semver
|
1295
1550
|
|
1296
1551
|
Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
|
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.
|
1
|
+
// Axios v1.6.0 Copyright (c) 2023 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) :
|
@@ -2187,7 +2187,8 @@
|
|
2187
2187
|
// Specifically not if we're in a web worker, or react-native.
|
2188
2188
|
if (platform.isStandardBrowserEnv) {
|
2189
2189
|
// Add xsrf header
|
2190
|
-
|
2190
|
+
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
2191
|
+
var xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
2191
2192
|
if (xsrfValue) {
|
2192
2193
|
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
2193
2194
|
}
|
@@ -2468,7 +2469,7 @@
|
|
2468
2469
|
return config;
|
2469
2470
|
}
|
2470
2471
|
|
2471
|
-
var VERSION = "1.
|
2472
|
+
var VERSION = "1.6.0";
|
2472
2473
|
|
2473
2474
|
var validators$1 = {};
|
2474
2475
|
|