axios 0.27.2 → 0.28.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 (50) hide show
  1. package/CHANGELOG.md +121 -58
  2. package/README.md +271 -80
  3. package/SECURITY.md +3 -3
  4. package/UPGRADE_GUIDE.md +16 -15
  5. package/bin/check-build-version.js +19 -0
  6. package/bin/ssl_hotfix.js +22 -0
  7. package/dist/axios.js +1993 -2226
  8. package/dist/axios.js.map +1 -0
  9. package/dist/axios.min.js +2 -3
  10. package/dist/axios.min.js.map +1 -0
  11. package/dist/esm/axios.js +2354 -0
  12. package/dist/esm/axios.js.map +1 -0
  13. package/dist/esm/axios.min.js +2 -0
  14. package/dist/esm/axios.min.js.map +1 -0
  15. package/index.d.ts +104 -19
  16. package/lib/adapters/http.js +153 -114
  17. package/lib/adapters/xhr.js +14 -10
  18. package/lib/axios.js +5 -1
  19. package/lib/cancel/CancelToken.js +4 -5
  20. package/lib/cancel/CanceledError.js +4 -2
  21. package/lib/core/Axios.js +6 -1
  22. package/lib/core/AxiosError.js +12 -1
  23. package/lib/core/InterceptorManager.js +9 -0
  24. package/lib/core/dispatchRequest.js +7 -0
  25. package/lib/core/mergeConfig.js +3 -0
  26. package/lib/core/transformData.js +3 -2
  27. package/lib/defaults/index.js +42 -13
  28. package/lib/env/data.js +1 -1
  29. package/lib/helpers/AxiosURLSearchParams.js +42 -0
  30. package/lib/helpers/bind.js +1 -5
  31. package/lib/helpers/buildURL.js +14 -37
  32. package/lib/helpers/formDataToJSON.js +71 -0
  33. package/lib/helpers/fromDataURI.js +51 -0
  34. package/lib/helpers/isURLSameOrigin.js +12 -12
  35. package/lib/helpers/parseHeaders.js +2 -2
  36. package/lib/helpers/toFormData.js +141 -34
  37. package/lib/helpers/toURLEncodedForm.js +18 -0
  38. package/lib/platform/browser/classes/FormData.js +3 -0
  39. package/lib/platform/browser/classes/URLSearchParams.js +5 -0
  40. package/lib/platform/browser/index.js +11 -0
  41. package/lib/platform/index.js +3 -0
  42. package/lib/platform/node/classes/FormData.js +3 -0
  43. package/lib/platform/node/classes/URLSearchParams.js +5 -0
  44. package/lib/platform/node/index.js +11 -0
  45. package/lib/utils.js +68 -16
  46. package/package.json +19 -6
  47. package/rollup.config.js +60 -0
  48. package/dist/axios.map +0 -1
  49. package/dist/axios.min.map +0 -1
  50. /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
- ### 0.18.x -> 0.19.0
3
+ ## 0.18.x -> 0.19.0
4
4
 
5
- #### HTTPS Proxies
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
- ### 0.15.x -> 0.16.0
9
+ ## 0.15.x -> 0.16.0
10
10
 
11
- #### `Promise` Type Declarations
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
- ### 0.13.x -> 0.14.0
15
+ ## 0.13.x -> 0.14.0
16
16
 
17
- #### TypeScript Definitions
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
- #### `agent` Config Option
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
- #### `progress` Config Option
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
- ### 0.12.x -> 0.13.0
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
- #### Error Handling
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
- #### Request Adapters
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
- ### 0.5.x -> 0.6.0
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
- #### ES6 Promise Polyfill
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
- #### `axios.success`/`axios.error`
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
- #### UMD
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
+ })