axios 0.27.2 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -58
- package/README.md +271 -80
- package/SECURITY.md +3 -3
- package/UPGRADE_GUIDE.md +16 -15
- package/bin/check-build-version.js +19 -0
- package/bin/ssl_hotfix.js +22 -0
- package/dist/axios.js +2007 -2225
- package/dist/axios.js.map +1 -0
- package/dist/axios.min.js +2 -3
- package/dist/axios.min.js.map +1 -0
- package/dist/esm/axios.js +2369 -0
- package/dist/esm/axios.js.map +1 -0
- package/dist/esm/axios.min.js +2 -0
- package/dist/esm/axios.min.js.map +1 -0
- package/index.d.ts +105 -19
- package/lib/adapters/http.js +153 -114
- package/lib/adapters/xhr.js +14 -10
- package/lib/axios.js +5 -1
- package/lib/cancel/CancelToken.js +4 -5
- package/lib/cancel/CanceledError.js +4 -2
- package/lib/core/Axios.js +13 -1
- package/lib/core/AxiosError.js +12 -1
- package/lib/core/InterceptorManager.js +9 -0
- package/lib/core/dispatchRequest.js +7 -0
- package/lib/core/mergeConfig.js +3 -0
- package/lib/core/transformData.js +3 -2
- package/lib/defaults/index.js +42 -13
- package/lib/env/data.js +1 -1
- package/lib/helpers/AxiosURLSearchParams.js +42 -0
- package/lib/helpers/bind.js +1 -5
- package/lib/helpers/buildURL.js +18 -33
- package/lib/helpers/formDataToJSON.js +71 -0
- package/lib/helpers/fromDataURI.js +51 -0
- package/lib/helpers/isURLSameOrigin.js +12 -12
- package/lib/helpers/parseHeaders.js +2 -2
- package/lib/helpers/toFormData.js +141 -34
- package/lib/helpers/toURLEncodedForm.js +18 -0
- package/lib/platform/browser/classes/FormData.js +3 -0
- package/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/lib/platform/browser/index.js +11 -0
- package/lib/platform/index.js +3 -0
- package/lib/platform/node/classes/FormData.js +3 -0
- package/lib/platform/node/classes/URLSearchParams.js +5 -0
- package/lib/platform/node/index.js +11 -0
- package/lib/utils.js +68 -16
- package/package.json +19 -6
- package/rollup.config.js +60 -0
- package/dist/axios.map +0 -1
- package/dist/axios.min.map +0 -1
- /package/lib/{defaults/env → env/classes}/FormData.js +0 -0
package/UPGRADE_GUIDE.md
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
# Upgrade Guide
|
2
2
|
|
3
|
-
|
3
|
+
## 0.18.x -> 0.19.0
|
4
4
|
|
5
|
-
|
5
|
+
### HTTPS Proxies
|
6
6
|
|
7
7
|
Routing through an https proxy now requires setting the `protocol` attribute of the proxy configuration to `https`
|
8
8
|
|
9
|
-
|
9
|
+
## 0.15.x -> 0.16.0
|
10
10
|
|
11
|
-
|
11
|
+
### `Promise` Type Declarations
|
12
12
|
|
13
13
|
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
|
14
14
|
|
15
|
-
|
15
|
+
## 0.13.x -> 0.14.0
|
16
16
|
|
17
|
-
|
17
|
+
### TypeScript Definitions
|
18
18
|
|
19
19
|
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
|
20
20
|
|
@@ -28,7 +28,7 @@ axios.get('/foo')
|
|
28
28
|
.catch(error => console.log(error));
|
29
29
|
```
|
30
30
|
|
31
|
-
|
31
|
+
### `agent` Config Option
|
32
32
|
|
33
33
|
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
|
34
34
|
|
@@ -41,7 +41,7 @@ The `agent` config option has been replaced with two new options: `httpAgent` an
|
|
41
41
|
}
|
42
42
|
```
|
43
43
|
|
44
|
-
|
44
|
+
### `progress` Config Option
|
45
45
|
|
46
46
|
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
|
47
47
|
|
@@ -59,11 +59,11 @@ The `progress` config option has been replaced with the `onUploadProgress` and `
|
|
59
59
|
}
|
60
60
|
```
|
61
61
|
|
62
|
-
|
62
|
+
## 0.12.x -> 0.13.0
|
63
63
|
|
64
64
|
The `0.13.0` release contains several changes to custom adapters and error handling.
|
65
65
|
|
66
|
-
|
66
|
+
### Error Handling
|
67
67
|
|
68
68
|
Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
|
69
69
|
|
@@ -77,7 +77,7 @@ axios.get('/user/12345')
|
|
77
77
|
});
|
78
78
|
```
|
79
79
|
|
80
|
-
|
80
|
+
### Request Adapters
|
81
81
|
|
82
82
|
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
|
83
83
|
|
@@ -121,14 +121,15 @@ function myAdapter(config) {
|
|
121
121
|
```
|
122
122
|
|
123
123
|
See the related commits for more details:
|
124
|
+
|
124
125
|
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
125
126
|
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
126
127
|
|
127
|
-
|
128
|
+
## 0.5.x -> 0.6.0
|
128
129
|
|
129
130
|
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
|
130
131
|
|
131
|
-
|
132
|
+
### ES6 Promise Polyfill
|
132
133
|
|
133
134
|
Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
|
134
135
|
|
@@ -139,7 +140,7 @@ var axios = require('axios');
|
|
139
140
|
|
140
141
|
This will polyfill the global environment, and only needs to be done once.
|
141
142
|
|
142
|
-
|
143
|
+
### `axios.success`/`axios.error`
|
143
144
|
|
144
145
|
The `success`, and `error` aliases were deprecated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
145
146
|
|
@@ -153,7 +154,7 @@ axios.get('some/url')
|
|
153
154
|
});
|
154
155
|
```
|
155
156
|
|
156
|
-
|
157
|
+
### UMD
|
157
158
|
|
158
159
|
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
|
159
160
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const assert = require('assert');
|
3
|
+
const axios = require('../index.js');
|
4
|
+
|
5
|
+
const {version} = JSON.parse(fs.readFileSync('./package.json'));
|
6
|
+
|
7
|
+
console.log('Checking versions...\n----------------------------')
|
8
|
+
|
9
|
+
console.log(`Package version: v${version}`);
|
10
|
+
console.log(`Axios version: v${axios.VERSION}`);
|
11
|
+
console.log(`----------------------------`);
|
12
|
+
|
13
|
+
assert.strictEqual(
|
14
|
+
version,
|
15
|
+
axios.VERSION,
|
16
|
+
`Version mismatch between package and Axios ${version} != ${axios.VERSION}`
|
17
|
+
);
|
18
|
+
|
19
|
+
console.log('✔️ PASSED\n');
|
@@ -0,0 +1,22 @@
|
|
1
|
+
const {spawn} = require('child_process');
|
2
|
+
|
3
|
+
const args = process.argv.slice(2);
|
4
|
+
|
5
|
+
console.log(`Running ${args.join(' ')} on ${process.version}\n`);
|
6
|
+
|
7
|
+
const match = /v(\d+)/.exec(process.version);
|
8
|
+
|
9
|
+
const isHotfixNeeded = match && match[1] > 16;
|
10
|
+
|
11
|
+
isHotfixNeeded && console.warn('Setting --openssl-legacy-provider as ssl hotfix');
|
12
|
+
|
13
|
+
const test = spawn('cross-env',
|
14
|
+
isHotfixNeeded ? ['NODE_OPTIONS=--openssl-legacy-provider', ...args] : args, {
|
15
|
+
shell: true,
|
16
|
+
stdio: 'inherit'
|
17
|
+
}
|
18
|
+
);
|
19
|
+
|
20
|
+
test.on('exit', function (code) {
|
21
|
+
process.exit(code)
|
22
|
+
})
|