axios 1.1.3 → 1.3.4
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 +312 -75
- package/{UPGRADE_GUIDE.md → MIGRATION_GUIDE.md} +1 -1
- package/README.md +64 -25
- package/dist/axios.js +888 -582
- 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 +3191 -0
- package/dist/browser/axios.cjs.map +1 -0
- package/dist/esm/axios.js +889 -626
- 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 +1001 -575
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +528 -0
- package/index.d.ts +116 -56
- package/index.js +12 -3
- package/lib/adapters/adapters.js +59 -0
- package/lib/adapters/http.js +118 -57
- package/lib/adapters/xhr.js +7 -4
- package/lib/axios.js +13 -3
- package/lib/core/Axios.js +10 -8
- package/lib/core/AxiosError.js +1 -1
- package/lib/core/AxiosHeaders.js +102 -80
- package/lib/core/dispatchRequest.js +7 -2
- package/lib/core/mergeConfig.js +50 -46
- package/lib/defaults/index.js +2 -21
- package/lib/env/classes/FormData.js +2 -2
- package/lib/env/data.js +1 -1
- package/lib/helpers/HttpStatusCode.js +71 -0
- package/lib/helpers/ZlibHeaderTransformStream.js +28 -0
- package/lib/helpers/formDataToStream.js +111 -0
- package/lib/helpers/readBlob.js +15 -0
- package/lib/helpers/speedometer.js +1 -1
- package/lib/helpers/toFormData.js +5 -15
- package/lib/platform/browser/classes/Blob.js +3 -0
- package/lib/platform/browser/classes/FormData.js +1 -1
- package/lib/platform/browser/index.js +21 -0
- package/lib/utils.js +107 -9
- package/package.json +86 -14
- package/bin/ssl_hotfix.js +0 -22
- package/gulpfile.js +0 -88
- package/karma.conf.cjs +0 -250
- package/lib/adapters/index.js +0 -33
- package/rollup.config.js +0 -90
- package/tsconfig.json +0 -14
- package/tslint.json +0 -6
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,316 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.3.4](https://github.com/axios/axios/compare/v1.3.3...v1.3.4) (2023-02-22)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **blob:** added a check to make sure the Blob class is available in the browser's global scope; ([#5548](https://github.com/axios/axios/issues/5548)) ([3772c8f](https://github.com/axios/axios/commit/3772c8fe74112a56e3e9551f894d899bc3a9443a))
|
9
|
+
* **http:** fixed regression bug when handling synchronous errors inside the adapter; ([#5564](https://github.com/axios/axios/issues/5564)) ([a3b246c](https://github.com/axios/axios/commit/a3b246c9de5c3bc4b5a742e15add55b375479451))
|
10
|
+
|
11
|
+
### Contributors to this release
|
12
|
+
|
13
|
+
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+38/-26 (#5564 )")
|
14
|
+
- <img src="https://avatars.githubusercontent.com/u/19550000?v=4&s=18" alt="avatar" width="18"/> [lcysgsg](https://github.com/lcysgsg "+4/-0 (#5548 )")
|
15
|
+
- <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 )")
|
16
|
+
|
17
|
+
## [1.3.3](https://github.com/axios/axios/compare/v1.3.2...v1.3.3) (2023-02-13)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* **formdata:** added a check to make sure the FormData class is available in the browser's global scope; ([#5545](https://github.com/axios/axios/issues/5545)) ([a6dfa72](https://github.com/axios/axios/commit/a6dfa72010db5ad52db8bd13c0f98e537e8fd05d))
|
23
|
+
* **formdata:** fixed setting NaN as Content-Length for form payload in some cases; ([#5535](https://github.com/axios/axios/issues/5535)) ([c19f7bf](https://github.com/axios/axios/commit/c19f7bf770f90ae8307f4ea3104f227056912da1))
|
24
|
+
* **headers:** fixed the filtering logic of the clear method; ([#5542](https://github.com/axios/axios/issues/5542)) ([ea87ebf](https://github.com/axios/axios/commit/ea87ebfe6d1699af072b9e7cd40faf8f14b0ab93))
|
25
|
+
|
26
|
+
### Contributors to this release
|
27
|
+
|
28
|
+
- <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 )")
|
29
|
+
- <img src="https://avatars.githubusercontent.com/u/19842213?v=4&s=18" alt="avatar" width="18"/> [陈若枫](https://github.com/ruofee "+2/-2 (#5467 )")
|
30
|
+
|
31
|
+
## [1.3.2](https://github.com/axios/axios/compare/v1.3.1...v1.3.2) (2023-02-03)
|
32
|
+
|
33
|
+
|
34
|
+
### Bug Fixes
|
35
|
+
|
36
|
+
* **http:** treat http://localhost as base URL for relative paths to avoid `ERR_INVALID_URL` error; ([#5528](https://github.com/axios/axios/issues/5528)) ([128d56f](https://github.com/axios/axios/commit/128d56f4a0fb8f5f2ed6e0dd80bc9225fee9538c))
|
37
|
+
* **http:** use explicit import instead of TextEncoder global; ([#5530](https://github.com/axios/axios/issues/5530)) ([6b3c305](https://github.com/axios/axios/commit/6b3c305fc40c56428e0afabedc6f4d29c2830f6f))
|
38
|
+
|
39
|
+
### Contributors to this release
|
40
|
+
|
41
|
+
- <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 )")
|
42
|
+
|
43
|
+
## [1.3.1](https://github.com/axios/axios/compare/v1.3.0...v1.3.1) (2023-02-01)
|
44
|
+
|
45
|
+
|
46
|
+
### Bug Fixes
|
47
|
+
|
48
|
+
* **formdata:** add hotfix to use the asynchronous API to compute the content-length header value; ([#5521](https://github.com/axios/axios/issues/5521)) ([96d336f](https://github.com/axios/axios/commit/96d336f527619f21da012fe1f117eeb53e5a2120))
|
49
|
+
* **serializer:** fixed serialization of array-like objects; ([#5518](https://github.com/axios/axios/issues/5518)) ([08104c0](https://github.com/axios/axios/commit/08104c028c0f9353897b1b6691d74c440fd0c32d))
|
50
|
+
|
51
|
+
### Contributors to this release
|
52
|
+
|
53
|
+
- <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 )")
|
54
|
+
|
55
|
+
# [1.3.0](https://github.com/axios/axios/compare/v1.2.6...v1.3.0) (2023-01-31)
|
56
|
+
|
57
|
+
|
58
|
+
### Bug Fixes
|
59
|
+
|
60
|
+
* **headers:** fixed & optimized clear method; ([#5507](https://github.com/axios/axios/issues/5507)) ([9915635](https://github.com/axios/axios/commit/9915635c69d0ab70daca5738488421f67ca60959))
|
61
|
+
* **http:** add zlib headers if missing ([#5497](https://github.com/axios/axios/issues/5497)) ([65e8d1e](https://github.com/axios/axios/commit/65e8d1e28ce829f47a837e45129730e541950d3c))
|
62
|
+
|
63
|
+
|
64
|
+
### Features
|
65
|
+
|
66
|
+
* **fomdata:** added support for spec-compliant FormData & Blob types; ([#5316](https://github.com/axios/axios/issues/5316)) ([6ac574e](https://github.com/axios/axios/commit/6ac574e00a06731288347acea1e8246091196953))
|
67
|
+
|
68
|
+
### Contributors to this release
|
69
|
+
|
70
|
+
- <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 )")
|
71
|
+
- <img src="https://avatars.githubusercontent.com/u/35015993?v=4&s=18" alt="avatar" width="18"/> [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )")
|
72
|
+
|
73
|
+
## [1.2.6](https://github.com/axios/axios/compare/v1.2.5...v1.2.6) (2023-01-28)
|
74
|
+
|
75
|
+
|
76
|
+
### Bug Fixes
|
77
|
+
|
78
|
+
* **headers:** added missed Authorization accessor; ([#5502](https://github.com/axios/axios/issues/5502)) ([342c0ba](https://github.com/axios/axios/commit/342c0ba9a16ea50f5ed7d2366c5c1a2c877e3f26))
|
79
|
+
* **types:** fixed `CommonRequestHeadersList` & `CommonResponseHeadersList` types to be private in commonJS; ([#5503](https://github.com/axios/axios/issues/5503)) ([5a3d0a3](https://github.com/axios/axios/commit/5a3d0a3234d77361a1bc7cedee2da1e11df08e2c))
|
80
|
+
|
81
|
+
### Contributors to this release
|
82
|
+
|
83
|
+
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )")
|
84
|
+
|
85
|
+
## [1.2.5](https://github.com/axios/axios/compare/v1.2.4...v1.2.5) (2023-01-26)
|
86
|
+
|
87
|
+
|
88
|
+
### Bug Fixes
|
89
|
+
|
90
|
+
* **types:** fixed AxiosHeaders to handle spread syntax by making all methods non-enumerable; ([#5499](https://github.com/axios/axios/issues/5499)) ([580f1e8](https://github.com/axios/axios/commit/580f1e8033a61baa38149d59fd16019de3932c22))
|
91
|
+
|
92
|
+
### Contributors to this release
|
93
|
+
|
94
|
+
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+82/-54 (#5499 )")
|
95
|
+
-  [Elliot Ford](https://github.com/EFord36 "+1/-1 (#5462 )")
|
96
|
+
|
97
|
+
## [1.2.4](https://github.com/axios/axios/compare/v1.2.3...v1.2.4) (2023-01-22)
|
98
|
+
|
99
|
+
|
100
|
+
### Bug Fixes
|
101
|
+
|
102
|
+
* **types:** renamed `RawAxiosRequestConfig` back to `AxiosRequestConfig`; ([#5486](https://github.com/axios/axios/issues/5486)) ([2a71f49](https://github.com/axios/axios/commit/2a71f49bc6c68495fa419003a3107ed8bd703ad0))
|
103
|
+
* **types:** fix `AxiosRequestConfig` generic; ([#5478](https://github.com/axios/axios/issues/5478)) ([9bce81b](https://github.com/axios/axios/commit/186ea062da8b7d578ae78b1a5c220986b9bce81b))
|
104
|
+
|
105
|
+
### Contributors to this release
|
106
|
+
|
107
|
+
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+242/-108 (#5486 #5482 )")
|
108
|
+
-  [Daniel Hillmann](https://github.com/hilleer "+1/-1 (#5478 )")
|
109
|
+
|
110
|
+
## [1.2.3](https://github.com/axios/axios/compare/1.2.2...1.2.3) (2023-01-10)
|
111
|
+
|
112
|
+
|
113
|
+
### Bug Fixes
|
114
|
+
|
115
|
+
* **types:** fixed AxiosRequestConfig header interface by refactoring it to RawAxiosRequestConfig; ([#5420](https://github.com/axios/axios/issues/5420)) ([0811963](https://github.com/axios/axios/commit/08119634a22f1d5b19f5c9ea0adccb6d3eebc3bc))
|
116
|
+
|
117
|
+
### Contributors to this release
|
118
|
+
|
119
|
+
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )")
|
120
|
+
|
121
|
+
## [1.2.2] - 2022-12-29
|
122
|
+
|
123
|
+
### Fixed
|
124
|
+
- fix(ci): fix release script inputs [#5392](https://github.com/axios/axios/pull/5392)
|
125
|
+
- fix(ci): prerelease scipts [#5377](https://github.com/axios/axios/pull/5377)
|
126
|
+
- fix(ci): release scripts [#5376](https://github.com/axios/axios/pull/5376)
|
127
|
+
- fix(ci): typescript tests [#5375](https://github.com/axios/axios/pull/5375)
|
128
|
+
- fix: Brotli decompression [#5353](https://github.com/axios/axios/pull/5353)
|
129
|
+
- fix: add missing HttpStatusCode [#5345](https://github.com/axios/axios/pull/5345)
|
130
|
+
|
131
|
+
### Chores
|
132
|
+
- chore(ci): set conventional-changelog header config [#5406](https://github.com/axios/axios/pull/5406)
|
133
|
+
- chore(ci): fix automatic contributors resolving [#5403](https://github.com/axios/axios/pull/5403)
|
134
|
+
- chore(ci): improved logging for the contributors list generator [#5398](https://github.com/axios/axios/pull/5398)
|
135
|
+
- chore(ci): fix release action [#5397](https://github.com/axios/axios/pull/5397)
|
136
|
+
- chore(ci): fix version bump script by adding bump argument for target version [#5393](https://github.com/axios/axios/pull/5393)
|
137
|
+
- chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 [#5342](https://github.com/axios/axios/pull/5342)
|
138
|
+
- chore(ci): GitHub Actions Release script [#5384](https://github.com/axios/axios/pull/5384)
|
139
|
+
- chore(ci): release scripts [#5364](https://github.com/axios/axios/pull/5364)
|
140
|
+
|
141
|
+
### Contributors to this release
|
142
|
+
-  [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
143
|
+
-  [Winnie](https://github.com/winniehell)
|
144
|
+
|
145
|
+
## [1.2.1] - 2022-12-05
|
146
|
+
|
147
|
+
### Changed
|
148
|
+
- feat(exports): export mergeConfig [#5151](https://github.com/axios/axios/pull/5151)
|
149
|
+
|
150
|
+
### Fixed
|
151
|
+
- fix(CancelledError): include config [#4922](https://github.com/axios/axios/pull/4922)
|
152
|
+
- fix(general): removing multiple/trailing/leading whitespace [#5022](https://github.com/axios/axios/pull/5022)
|
153
|
+
- fix(headers): decompression for responses without Content-Length header [#5306](https://github.com/axios/axios/pull/5306)
|
154
|
+
- fix(webWorker): exception to sending form data in web worker [#5139](https://github.com/axios/axios/pull/5139)
|
155
|
+
|
156
|
+
### Refactors
|
157
|
+
- refactor(types): AxiosProgressEvent.event type to any [#5308](https://github.com/axios/axios/pull/5308)
|
158
|
+
- refactor(types): add missing types for static AxiosError.from method [#4956](https://github.com/axios/axios/pull/4956)
|
159
|
+
|
160
|
+
### Chores
|
161
|
+
- chore(docs): remove README link to non-existent upgrade guide [#5307](https://github.com/axios/axios/pull/5307)
|
162
|
+
- chore(docs): typo in issue template name [#5159](https://github.com/axios/axios/pull/5159)
|
163
|
+
|
164
|
+
### Contributors to this release
|
165
|
+
|
166
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
167
|
+
- [Zachary Lysobey](https://github.com/zachlysobey)
|
168
|
+
- [Kevin Ennis](https://github.com/kevincennis)
|
169
|
+
- [Philipp Loose](https://github.com/phloose)
|
170
|
+
- [secondl1ght](https://github.com/secondl1ght)
|
171
|
+
- [wenzheng](https://github.com/0x30)
|
172
|
+
- [Ivan Barsukov](https://github.com/ovarn)
|
173
|
+
- [Arthur Fiorette](https://github.com/arthurfiorette)
|
174
|
+
|
175
|
+
## [1.2.0] - 2022-11-10
|
176
|
+
|
177
|
+
### Changed
|
178
|
+
|
179
|
+
- changed: refactored module exports [#5162](https://github.com/axios/axios/pull/5162)
|
180
|
+
- change: re-added support for loading Axios with require('axios').default [#5225](https://github.com/axios/axios/pull/5225)
|
181
|
+
|
182
|
+
### Fixed
|
183
|
+
|
184
|
+
- fix: improve AxiosHeaders class [#5224](https://github.com/axios/axios/pull/5224)
|
185
|
+
- fix: TypeScript type definitions for commonjs [#5196](https://github.com/axios/axios/pull/5196)
|
186
|
+
- fix: type definition of use method on AxiosInterceptorManager to match the the README [#5071](https://github.com/axios/axios/pull/5071)
|
187
|
+
- fix: __dirname is not defined in the sandbox [#5269](https://github.com/axios/axios/pull/5269)
|
188
|
+
- fix: AxiosError.toJSON method to avoid circular references [#5247](https://github.com/axios/axios/pull/5247)
|
189
|
+
- fix: Z_BUF_ERROR when content-encoding is set but the response body is empty [#5250](https://github.com/axios/axios/pull/5250)
|
190
|
+
|
191
|
+
### Refactors
|
192
|
+
- refactor: allowing adapters to be loaded by name [#5277](https://github.com/axios/axios/pull/5277)
|
193
|
+
|
194
|
+
### Chores
|
195
|
+
|
196
|
+
- chore: force CI restart [#5243](https://github.com/axios/axios/pull/5243)
|
197
|
+
- chore: update ECOSYSTEM.md [#5077](https://github.com/axios/axios/pull/5077)
|
198
|
+
- chore: update get/index.html [#5116](https://github.com/axios/axios/pull/5116)
|
199
|
+
- chore: update Sandbox UI/UX [#5205](https://github.com/axios/axios/pull/5205)
|
200
|
+
- chore:(actions): remove git credentials after checkout [#5235](https://github.com/axios/axios/pull/5235)
|
201
|
+
- chore(actions): bump actions/dependency-review-action from 2 to 3 [#5266](https://github.com/axios/axios/pull/5266)
|
202
|
+
- chore(packages): bump loader-utils from 1.4.1 to 1.4.2 [#5295](https://github.com/axios/axios/pull/5295)
|
203
|
+
- chore(packages): bump engine.io from 6.2.0 to 6.2.1 [#5294](https://github.com/axios/axios/pull/5294)
|
204
|
+
- chore(packages): bump socket.io-parser from 4.0.4 to 4.0.5 [#5241](https://github.com/axios/axios/pull/5241)
|
205
|
+
- chore(packages): bump loader-utils from 1.4.0 to 1.4.1 [#5245](https://github.com/axios/axios/pull/5245)
|
206
|
+
- chore(docs): update Resources links in README [#5119](https://github.com/axios/axios/pull/5119)
|
207
|
+
- chore(docs): update the link for JSON url [#5265](https://github.com/axios/axios/pull/5265)
|
208
|
+
- chore(docs): fix broken links [#5218](https://github.com/axios/axios/pull/5218)
|
209
|
+
- chore(docs): update and rename UPGRADE_GUIDE.md to MIGRATION_GUIDE.md [#5170](https://github.com/axios/axios/pull/5170)
|
210
|
+
- chore(docs): typo fix line #856 and #920 [#5194](https://github.com/axios/axios/pull/5194)
|
211
|
+
- chore(docs): typo fix #800 [#5193](https://github.com/axios/axios/pull/5193)
|
212
|
+
- chore(docs): fix typos [#5184](https://github.com/axios/axios/pull/5184)
|
213
|
+
- chore(docs): fix punctuation in README.md [#5197](https://github.com/axios/axios/pull/5197)
|
214
|
+
- chore(docs): update readme in the Handling Errors section - issue reference #5260 [#5261](https://github.com/axios/axios/pull/5261)
|
215
|
+
- chore: remove \b from filename [#5207](https://github.com/axios/axios/pull/5207)
|
216
|
+
- chore(docs): update CHANGELOG.md [#5137](https://github.com/axios/axios/pull/5137)
|
217
|
+
- chore: add sideEffects false to package.json [#5025](https://github.com/axios/axios/pull/5025)
|
218
|
+
|
219
|
+
### Contributors to this release
|
220
|
+
|
221
|
+
- [Maddy Miller](https://github.com/me4502)
|
222
|
+
- [Amit Saini](https://github.com/amitsainii)
|
223
|
+
- [ecyrbe](https://github.com/ecyrbe)
|
224
|
+
- [Ikko Ashimine](https://github.com/eltociear)
|
225
|
+
- [Geeth Gunnampalli](https://github.com/thetechie7)
|
226
|
+
- [Shreem Asati](https://github.com/shreem-123)
|
227
|
+
- [Frieder Bluemle](https://github.com/friederbluemle)
|
228
|
+
- [윤세영](https://github.com/yunseyeong)
|
229
|
+
- [Claudio Busatto](https://github.com/cjcbusatto)
|
230
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
231
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
232
|
+
- [Csaba Maulis](https://github.com/om4csaba)
|
233
|
+
- [MoPaMo](https://github.com/MoPaMo)
|
234
|
+
- [Daniel Fjeldstad](https://github.com/w3bdesign)
|
235
|
+
- [Adrien Brunet](https://github.com/adrien-may)
|
236
|
+
- [Frazer Smith](https://github.com/Fdawgs)
|
237
|
+
- [HaiTao](https://github.com/836334258)
|
238
|
+
- [AZM](https://github.com/aziyatali)
|
239
|
+
- [relbns](https://github.com/relbns)
|
240
|
+
|
241
|
+
## [1.1.3] - 2022-10-15
|
242
|
+
|
243
|
+
### Added
|
244
|
+
|
245
|
+
- Added custom params serializer support [#5113](https://github.com/axios/axios/pull/5113)
|
246
|
+
|
247
|
+
### Fixed
|
248
|
+
|
249
|
+
- Fixed top-level export to keep them in-line with static properties [#5109](https://github.com/axios/axios/pull/5109)
|
250
|
+
- Stopped including null values to query string. [#5108](https://github.com/axios/axios/pull/5108)
|
251
|
+
- Restored proxy config backwards compatibility with 0.x [#5097](https://github.com/axios/axios/pull/5097)
|
252
|
+
- Added back AxiosHeaders in AxiosHeaderValue [#5103](https://github.com/axios/axios/pull/5103)
|
253
|
+
- Pin CDN install instructions to a specific version [#5060](https://github.com/axios/axios/pull/5060)
|
254
|
+
- Handling of array values fixed for AxiosHeaders [#5085](https://github.com/axios/axios/pull/5085)
|
255
|
+
|
256
|
+
### Chores
|
257
|
+
|
258
|
+
- docs: match badge style, add link to them [#5046](https://github.com/axios/axios/pull/5046)
|
259
|
+
- chore: fixing comments typo [#5054](https://github.com/axios/axios/pull/5054)
|
260
|
+
- chore: update issue template [#5061](https://github.com/axios/axios/pull/5061)
|
261
|
+
- chore: added progress capturing section to the docs; [#5084](https://github.com/axios/axios/pull/5084)
|
262
|
+
|
263
|
+
### Contributors to this release
|
264
|
+
|
265
|
+
- [Jason Saayman](https://github.com/jasonsaayman)
|
266
|
+
- [scarf](https://github.com/scarf005)
|
267
|
+
- [Lenz Weber-Tronic](https://github.com/phryneas)
|
268
|
+
- [Arvindh](https://github.com/itsarvindh)
|
269
|
+
- [Félix Legrelle](https://github.com/FelixLgr)
|
270
|
+
- [Patrick Petrovic](https://github.com/ppati000)
|
271
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
272
|
+
- [littledian](https://github.com/littledian)
|
273
|
+
- [ChronosMasterOfAllTime](https://github.com/ChronosMasterOfAllTime)
|
274
|
+
|
275
|
+
## [1.1.2] - 2022-10-07
|
276
|
+
|
277
|
+
### Fixed
|
278
|
+
|
279
|
+
- Fixed broken exports for UMD builds.
|
280
|
+
|
281
|
+
### Contributors to this release
|
282
|
+
|
283
|
+
- [Jason Saayman](https://github.com/jasonsaayman)
|
284
|
+
|
285
|
+
## [1.1.1] - 2022-10-07
|
286
|
+
|
287
|
+
### Fixed
|
288
|
+
|
289
|
+
- Fixed broken exports for common js. This fix breaks a prior fix, I will fix both issues ASAP but the commonJS use is more impactful.
|
290
|
+
|
291
|
+
### Contributors to this release
|
292
|
+
|
293
|
+
- [Jason Saayman](https://github.com/jasonsaayman)
|
294
|
+
|
295
|
+
## [1.1.0] - 2022-10-06
|
296
|
+
|
297
|
+
### Fixed
|
298
|
+
|
299
|
+
- Fixed missing exports in type definition index.d.ts [#5003](https://github.com/axios/axios/pull/5003)
|
300
|
+
- Fixed query params composing [#5018](https://github.com/axios/axios/pull/5018)
|
301
|
+
- Fixed GenericAbortSignal interface by making it more generic [#5021](https://github.com/axios/axios/pull/5021)
|
302
|
+
- Fixed adding "clear" to AxiosInterceptorManager [#5010](https://github.com/axios/axios/pull/5010)
|
303
|
+
- Fixed commonjs & umd exports [#5030](https://github.com/axios/axios/pull/5030)
|
304
|
+
- Fixed inability to access response headers when using axios 1.x with Jest [#5036](https://github.com/axios/axios/pull/5036)
|
305
|
+
|
306
|
+
### Contributors to this release
|
307
|
+
|
308
|
+
- [Trim21](https://github.com/trim21)
|
309
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
310
|
+
- [shingo.sasaki](https://github.com/s-sasaki-0529)
|
311
|
+
- [Ivan Pepelko](https://github.com/ivanpepelko)
|
312
|
+
- [Richard Kořínek](https://github.com/risa)
|
313
|
+
|
3
314
|
## [1.0.0] - 2022-10-04
|
4
315
|
|
5
316
|
### Added
|
@@ -178,78 +489,4 @@
|
|
178
489
|
- [Marco Weber](https://github.com/mrcwbr)
|
179
490
|
- [Luca Pizzini](https://github.com/lpizzinidev)
|
180
491
|
- [Willian Agostini](https://github.com/WillianAgostini)
|
181
|
-
- [Huyen Nguyen](https://github.com/huyenltnguyen)
|
182
|
-
|
183
|
-
## [1.1.0] - 2022-10-06
|
184
|
-
|
185
|
-
### Fixed
|
186
|
-
|
187
|
-
- Fixed missing exports in type definition index.d.ts [#5003](https://github.com/axios/axios/pull/5003)
|
188
|
-
- Fixed query params composing [#5018](https://github.com/axios/axios/pull/5018)
|
189
|
-
- Fixed GenericAbortSignal interface by making it more generic [#5021](https://github.com/axios/axios/pull/5021)
|
190
|
-
- Fixed adding "clear" to AxiosInterceptorManager [#5010](https://github.com/axios/axios/pull/5010)
|
191
|
-
- Fixed commonjs & umd exports [#5030](https://github.com/axios/axios/pull/5030)
|
192
|
-
- Fixed inability to access response headers when using axios 1.x with Jest [#5036](https://github.com/axios/axios/pull/5036)
|
193
|
-
|
194
|
-
### Contributors to this release
|
195
|
-
|
196
|
-
- [Trim21](https://github.com/trim21)
|
197
|
-
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
198
|
-
- [shingo.sasaki](https://github.com/s-sasaki-0529)
|
199
|
-
- [Ivan Pepelko](https://github.com/ivanpepelko)
|
200
|
-
- [Richard Kořínek](https://github.com/risa)
|
201
|
-
|
202
|
-
## [1.1.1] - 2022-10-07
|
203
|
-
|
204
|
-
### Fixed
|
205
|
-
|
206
|
-
- Fixed broken exports for common js. This fix breaks a prior fix, I will fix both issues ASAP but the commonJS use is more impactful.
|
207
|
-
|
208
|
-
### Contributors to this release
|
209
|
-
|
210
|
-
- [Jason Saayman](https://github.com/jasonsaayman)
|
211
|
-
|
212
|
-
## [1.1.2] - 2022-10-07
|
213
|
-
|
214
|
-
### Fixed
|
215
|
-
|
216
|
-
- Fixed broken exports for UMD builds.
|
217
|
-
|
218
|
-
### Contributors to this release
|
219
|
-
|
220
|
-
- [Jason Saayman](https://github.com/jasonsaayman)
|
221
|
-
|
222
|
-
## [1.1.3] - 2022-10-15
|
223
|
-
|
224
|
-
### Added
|
225
|
-
Added custom params serializer support [#5113](https://github.com/axios/axios/pull/5113)
|
226
|
-
|
227
|
-
### Fixed
|
228
|
-
|
229
|
-
Fixed top-level export to keep them in-line with static properties [#5109](https://github.com/axios/axios/pull/5109)
|
230
|
-
Stopped including null values to query string. [#5108](https://github.com/axios/axios/pull/5108)
|
231
|
-
Restored proxy config backwards compatibility with 0.x [#5097](https://github.com/axios/axios/pull/5097)
|
232
|
-
Added back AxiosHeaders in AxiosHeaderValue [#5103](https://github.com/axios/axios/pull/5103)
|
233
|
-
Pin CDN install instructions to a specific version [#5060](https://github.com/axios/axios/pull/5060)
|
234
|
-
Handling of array values fixed for AxiosHeaders [#5085](https://github.com/axios/axios/pull/5085)
|
235
|
-
|
236
|
-
### Chores
|
237
|
-
|
238
|
-
docs: match badge style, add link to them [#5046](https://github.com/axios/axios/pull/5046)
|
239
|
-
chore: fixing comments typo [#5054](https://github.com/axios/axios/pull/5054)
|
240
|
-
chore: update issue template [#5061](https://github.com/axios/axios/pull/5061)
|
241
|
-
chore: added progress capturing section to the docs; [#5084](https://github.com/axios/axios/pull/5084)
|
242
|
-
|
243
|
-
### Contributors to this release
|
244
|
-
|
245
|
-
- [Jason Saayman](https://github.com/jasonsaayman)
|
246
|
-
- [scarf](https://github.com/scarf005)
|
247
|
-
- [Lenz Weber-Tronic](https://github.com/phryneas)
|
248
|
-
- [Arvindh](https://github.com/itsarvindh)
|
249
|
-
- [Félix Legrelle](https://github.com/FelixLgr)
|
250
|
-
- [Patrick Petrovic](https://github.com/ppati000)
|
251
|
-
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
252
|
-
- [littledian](https://github.com/littledian)
|
253
|
-
- [ChronosMasterOfAllTime](https://github.com/ChronosMasterOfAllTime)
|
254
|
-
- [Salman Shaikh](https://github.com/salmannotkhan)
|
255
|
-
|
492
|
+
- [Huyen Nguyen](https://github.com/huyenltnguyen)
|
package/README.md
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
<p align="center">
|
10
10
|
<a href="https://axios-http.com/"><b>Website</b></a> •
|
11
11
|
<a href="https://axios-http.com/docs/intro"><b>Documentation</b></a>
|
12
|
-
</p>
|
12
|
+
</p>
|
13
13
|
|
14
14
|
<div align="center">
|
15
15
|
|
16
16
|
[](https://www.npmjs.org/package/axios)
|
17
17
|
[](https://cdnjs.com/libraries/axios)
|
18
|
-
[](https://github.com/axios/axios/actions/workflows/ci.yml)
|
18
|
+
[](https://github.com/axios/axios/actions/workflows/ci.yml)
|
19
19
|
[](https://gitpod.io/#https://github.com/axios/axios)
|
20
20
|
[](https://coveralls.io/r/mzabriskie/axios)
|
21
21
|
[](https://packagephobia.now.sh/result?p=axios)
|
@@ -29,12 +29,14 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
</div>
|
32
|
-
|
32
|
+
|
33
33
|
## Table of Contents
|
34
34
|
|
35
35
|
- [Features](#features)
|
36
36
|
- [Browser Support](#browser-support)
|
37
37
|
- [Installing](#installing)
|
38
|
+
- [Package manager](#package-manager)
|
39
|
+
- [CDN](#cdn)
|
38
40
|
- [Example](#example)
|
39
41
|
- [Axios API](#axios-api)
|
40
42
|
- [Request method aliases](#request-method-aliases)
|
@@ -79,7 +81,7 @@
|
|
79
81
|
- Intercept request and response
|
80
82
|
- Transform request and response data
|
81
83
|
- Cancel requests
|
82
|
-
- Automatic transforms for JSON data
|
84
|
+
- Automatic transforms for [JSON](https://www.json.org/json-en.html) data
|
83
85
|
- 🆕 Automatic data object serialization to `multipart/form-data` and `x-www-form-urlencoded` body encodings
|
84
86
|
- Client side support for protecting against [XSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery)
|
85
87
|
|
@@ -93,6 +95,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
|
93
95
|
|
94
96
|
## Installing
|
95
97
|
|
98
|
+
### Package manager
|
99
|
+
|
96
100
|
Using npm:
|
97
101
|
|
98
102
|
```bash
|
@@ -117,7 +121,39 @@ Using pnpm:
|
|
117
121
|
$ pnpm add axios
|
118
122
|
```
|
119
123
|
|
120
|
-
|
124
|
+
Once the package is installed, you can import the library using `import` or `require` approach:
|
125
|
+
|
126
|
+
```js
|
127
|
+
import axios, {isCancel, AxiosError} from 'axios';
|
128
|
+
```
|
129
|
+
|
130
|
+
You can also use the default export, since the named export is just a re-export from the Axios factory:
|
131
|
+
|
132
|
+
```js
|
133
|
+
import axios from 'axios';
|
134
|
+
|
135
|
+
console.log(axios.isCancel('something'));
|
136
|
+
````
|
137
|
+
|
138
|
+
If you use `require` for importing, **only default export is available**:
|
139
|
+
|
140
|
+
```js
|
141
|
+
const axios = require('axios');
|
142
|
+
|
143
|
+
console.log(axios.isCancel('something'));
|
144
|
+
```
|
145
|
+
|
146
|
+
For cases where something went wrong when trying to import a module into a custom or legacy environment,
|
147
|
+
you can try importing the module package directly:
|
148
|
+
|
149
|
+
```js
|
150
|
+
const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundle (ES2017)
|
151
|
+
// const axios = require('axios/dist/node/axios.cjs'); // node commonJS bundle (ES2017)
|
152
|
+
```
|
153
|
+
|
154
|
+
### CDN
|
155
|
+
|
156
|
+
Using jsDelivr CDN (ES5 UMD browser module):
|
121
157
|
|
122
158
|
```html
|
123
159
|
<script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
|
@@ -131,19 +167,12 @@ Using unpkg CDN:
|
|
131
167
|
|
132
168
|
## Example
|
133
169
|
|
134
|
-
|
135
|
-
In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()
|
136
|
-
|
137
|
-
```js
|
138
|
-
const axios = require('axios').default;
|
139
|
-
|
140
|
-
// axios.<method> will now provide autocomplete and parameter typings
|
141
|
-
```
|
142
|
-
|
143
|
-
Performing a `GET` request
|
170
|
+
> **Note** CommonJS usage
|
171
|
+
> In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()`, use the following approach:
|
144
172
|
|
145
173
|
```js
|
146
|
-
|
174
|
+
import axios from 'axios';
|
175
|
+
//const axios = require('axios'); // legacy way
|
147
176
|
|
148
177
|
// Make a request for a user with a given ID
|
149
178
|
axios.get('/user?ID=12345')
|
@@ -463,6 +492,9 @@ These are the available config options for making requests. Only the `url` is re
|
|
463
492
|
// Only either `socketPath` or `proxy` can be specified.
|
464
493
|
// If both are specified, `socketPath` is used.
|
465
494
|
socketPath: null, // default
|
495
|
+
|
496
|
+
// `transport` determines the transport method that will be used to make the request. If defined, it will be used. Otherwise, if `maxRedirects` is 0, the default `http` or `https` library will be used, depending on the protocol specified in `protocol`. Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol, which can handle redirects.
|
497
|
+
transport: undefined, // default
|
466
498
|
|
467
499
|
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
468
500
|
// and https requests, respectively, in node.js. This allows options to be added like
|
@@ -734,6 +766,8 @@ Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all t
|
|
734
766
|
|
735
767
|
## Handling Errors
|
736
768
|
|
769
|
+
the default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error.
|
770
|
+
|
737
771
|
```js
|
738
772
|
axios.get('/user/12345')
|
739
773
|
.catch(function (error) {
|
@@ -756,7 +790,7 @@ axios.get('/user/12345')
|
|
756
790
|
});
|
757
791
|
```
|
758
792
|
|
759
|
-
Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
|
793
|
+
Using the `validateStatus` config option, you can override the default condition (status >= 200 && status < 300) and define HTTP code(s) that should throw an error.
|
760
794
|
|
761
795
|
```js
|
762
796
|
axios.get('/user/12345', {
|
@@ -797,7 +831,7 @@ controller.abort()
|
|
797
831
|
|
798
832
|
You can also cancel a request using a *CancelToken*.
|
799
833
|
|
800
|
-
> The axios cancel token API is based on the withdrawn [
|
834
|
+
> The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
|
801
835
|
|
802
836
|
> This API is deprecated since v0.22.0 and shouldn't be used in new projects
|
803
837
|
|
@@ -853,7 +887,7 @@ cancel();
|
|
853
887
|
|
854
888
|
### URLSearchParams
|
855
889
|
|
856
|
-
By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers, [
|
890
|
+
By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers,and [ Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018).
|
857
891
|
|
858
892
|
```js
|
859
893
|
const params = new URLSearchParams({ foo: 'bar' });
|
@@ -917,7 +951,7 @@ await axios.postForm('https://postman-echo.com/post', data,
|
|
917
951
|
);
|
918
952
|
```
|
919
953
|
|
920
|
-
The server will handle it as
|
954
|
+
The server will handle it as:
|
921
955
|
|
922
956
|
```js
|
923
957
|
{
|
@@ -1250,6 +1284,12 @@ try {
|
|
1250
1284
|
}
|
1251
1285
|
```
|
1252
1286
|
|
1287
|
+
Because axios dual publishes with an ESM default export and a CJS `module.exports`, there are some caveats.
|
1288
|
+
The recommended setting is to use `"moduleResolution": "node16"` (this is implied by `"module": "node16"`). Note that this requires TypeScript 4.7 or greater.
|
1289
|
+
If use ESM, your settings should be fine.
|
1290
|
+
If you compile TypeScript to CJS and you can’t use `"moduleResolution": "node 16"`, you have to enable `esModuleInterop`.
|
1291
|
+
If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`.
|
1292
|
+
|
1253
1293
|
## Online one-click setup
|
1254
1294
|
|
1255
1295
|
You can use Gitpod, an online IDE(which is free for Open Source) for contributing or running the examples online.
|
@@ -1259,11 +1299,10 @@ You can use Gitpod, an online IDE(which is free for Open Source) for contributin
|
|
1259
1299
|
|
1260
1300
|
## Resources
|
1261
1301
|
|
1262
|
-
* [Changelog](https://github.com/axios/axios/blob/
|
1263
|
-
* [
|
1264
|
-
* [
|
1265
|
-
* [
|
1266
|
-
* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
|
1302
|
+
* [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
|
1303
|
+
* [Ecosystem](https://github.com/axios/axios/blob/v1.x/ECOSYSTEM.md)
|
1304
|
+
* [Contributing Guide](https://github.com/axios/axios/blob/v1.x/CONTRIBUTING.md)
|
1305
|
+
* [Code of Conduct](https://github.com/axios/axios/blob/v1.x/CODE_OF_CONDUCT.md)
|
1267
1306
|
|
1268
1307
|
## Credits
|
1269
1308
|
|