axios 0.21.3 → 0.24.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.
- package/CHANGELOG.md +73 -0
- package/README.md +28 -4
- package/dist/axios.js +203 -106
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +1 -2
- package/dist/axios.min.map +1 -1
- package/index.d.ts +73 -35
- package/lib/adapters/http.js +46 -14
- package/lib/adapters/xhr.js +32 -9
- package/lib/axios.js +6 -5
- package/lib/cancel/CancelToken.js +62 -0
- package/lib/core/Axios.js +3 -3
- package/lib/core/dispatchRequest.js +5 -0
- package/lib/core/enhanceError.js +2 -1
- package/lib/core/mergeConfig.js +50 -38
- package/lib/defaults.js +22 -7
- package/lib/env/README.md +3 -0
- package/lib/env/data.js +3 -0
- package/lib/helpers/validator.js +7 -30
- package/package.json +8 -6
- package/tsconfig.json +14 -0
- package/tslint.json +6 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,78 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.24.0 (October 25, 2021)
|
4
|
+
|
5
|
+
Breaking changes:
|
6
|
+
- Revert: change type of AxiosResponse to any, please read lengthy discussion here: ([4141](https://github.com/axios/axios/issues/4141)) pull request: ([#4114](https://github.com/axios/axios/pull/4114))
|
7
|
+
|
8
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
9
|
+
|
10
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
11
|
+
- [Rodry](https://github.com/ImRodry)
|
12
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
13
|
+
- [Isaiah Thomason](https://github.com/ITenthusiasm)
|
14
|
+
|
15
|
+
### 0.23.0 (October 12, 2021)
|
16
|
+
|
17
|
+
Breaking changes:
|
18
|
+
- Distinguish request and response data types ([#4116](https://github.com/axios/axios/pull/4116))
|
19
|
+
- Change never type to unknown ([#4142](https://github.com/axios/axios/pull/4142))
|
20
|
+
- Fixed TransitionalOptions typings ([#4147](https://github.com/axios/axios/pull/4147))
|
21
|
+
|
22
|
+
Fixes and Functionality:
|
23
|
+
- Adding globalObject: 'this' to webpack config ([#3176](https://github.com/axios/axios/pull/3176))
|
24
|
+
- Adding insecureHTTPParser type to AxiosRequestConfig ([#4066](https://github.com/axios/axios/pull/4066))
|
25
|
+
- Fix missing semicolon in typings ([#4115](https://github.com/axios/axios/pull/4115))
|
26
|
+
- Fix response headers types ([#4136](https://github.com/axios/axios/pull/4136))
|
27
|
+
|
28
|
+
Internal and Tests:
|
29
|
+
- Improve timeout error when timeout is browser default ([#3209](https://github.com/axios/axios/pull/3209))
|
30
|
+
- Fix node version on CI ([#4069](https://github.com/axios/axios/pull/4069))
|
31
|
+
- Added testing to TypeScript portion of project ([#4140](https://github.com/axios/axios/pull/4140))
|
32
|
+
|
33
|
+
Documentation:
|
34
|
+
- Rename Angular to AngularJS ([#4114](https://github.com/axios/axios/pull/4114))
|
35
|
+
|
36
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
37
|
+
|
38
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
39
|
+
- [Evan-Finkelstein](https://github.com/Evan-Finkelstein)
|
40
|
+
- [Paweł Szymański](https://github.com/Jezorko)
|
41
|
+
- [Dobes Vandermeer](https://github.com/dobesv)
|
42
|
+
- [Claas Augner](https://github.com/caugner)
|
43
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
44
|
+
- [Evgeniy](https://github.com/egmen)
|
45
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
46
|
+
|
47
|
+
### 0.22.0 (October 01, 2021)
|
48
|
+
|
49
|
+
Fixes and Functionality:
|
50
|
+
- Caseless header comparing in HTTP adapter ([#2880](https://github.com/axios/axios/pull/2880))
|
51
|
+
- Avoid package.json import fixing issues and warnings related to this ([#4041](https://github.com/axios/axios/pull/4041)), ([#4065](https://github.com/axios/axios/pull/4065))
|
52
|
+
- Fixed cancelToken leakage and added AbortController support ([#3305](https://github.com/axios/axios/pull/3305))
|
53
|
+
- Updating CI to run on release branches
|
54
|
+
- Bump follow redirects version
|
55
|
+
- Fixed default transitional config for custom Axios instance; ([#4052](https://github.com/axios/axios/pull/4052))
|
56
|
+
|
57
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
58
|
+
|
59
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
60
|
+
- [Matt R. Wilson](https://github.com/mastermatt)
|
61
|
+
- [Xianming Zhong](https://github.com/chinesedfan)
|
62
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
63
|
+
|
64
|
+
### 0.21.4 (September 6, 2021)
|
65
|
+
|
66
|
+
Fixes and Functionality:
|
67
|
+
- Fixing JSON transform when data is stringified. Providing backward compatability and complying to the JSON RFC standard ([#4020](https://github.com/axios/axios/pull/4020))
|
68
|
+
|
69
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
70
|
+
|
71
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
72
|
+
- [Guillaume Fortaine](https://github.com/gfortaine)
|
73
|
+
- [Yusuke Kawasaki](https://github.com/kawanet)
|
74
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
75
|
+
|
3
76
|
### 0.21.3 (September 4, 2021)
|
4
77
|
|
5
78
|
Fixes and Functionality:
|
package/README.md
CHANGED
@@ -452,11 +452,22 @@ These are the available config options for making requests. Only the `url` is re
|
|
452
452
|
cancelToken: new CancelToken(function (cancel) {
|
453
453
|
}),
|
454
454
|
|
455
|
+
// an alternative way to cancel Axios requests using AbortController
|
456
|
+
signal: new AbortController().signal,
|
457
|
+
|
455
458
|
// `decompress` indicates whether or not the response body should be decompressed
|
456
459
|
// automatically. If set to `true` will also remove the 'content-encoding' header
|
457
460
|
// from the responses objects of all decompressed responses
|
458
461
|
// - Node only (XHR cannot turn off decompression)
|
459
|
-
decompress: true
|
462
|
+
decompress: true // default
|
463
|
+
|
464
|
+
// `insecureHTTPParser` boolean.
|
465
|
+
// Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
|
466
|
+
// This may allow interoperability with non-conformant HTTP implementations.
|
467
|
+
// Using the insecure parser should be avoided.
|
468
|
+
// see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
|
469
|
+
// see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
|
470
|
+
insecureHTTPParser: undefined // default
|
460
471
|
|
461
472
|
// transitional options for backward compatibility that may be removed in the newer versions
|
462
473
|
transitional: {
|
@@ -466,7 +477,7 @@ These are the available config options for making requests. Only the `url` is re
|
|
466
477
|
silentJSONParsing: true, // default value for the current Axios version
|
467
478
|
|
468
479
|
// try to parse the response string as JSON even if `responseType` is not 'json'
|
469
|
-
forcedJSONParsing: true
|
480
|
+
forcedJSONParsing: true,
|
470
481
|
|
471
482
|
// throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
|
472
483
|
clarifyTimeoutError: false,
|
@@ -726,7 +737,20 @@ axios.get('/user/12345', {
|
|
726
737
|
cancel();
|
727
738
|
```
|
728
739
|
|
729
|
-
|
740
|
+
Axios supports AbortController to abort requests in [`fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#aborting_a_fetch) way:
|
741
|
+
```js
|
742
|
+
const controller = new AbortController();
|
743
|
+
|
744
|
+
axios.get('/foo/bar', {
|
745
|
+
signal: controller.signal
|
746
|
+
}).then(function(response) {
|
747
|
+
//...
|
748
|
+
});
|
749
|
+
// cancel the request
|
750
|
+
controller.abort()
|
751
|
+
```
|
752
|
+
|
753
|
+
> Note: you can cancel several requests with the same cancel token/abort controller.
|
730
754
|
> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make real request.
|
731
755
|
|
732
756
|
## Using application/x-www-form-urlencoded format
|
@@ -861,7 +885,7 @@ You can use Gitpod an online IDE(which is free for Open Source) for contributing
|
|
861
885
|
|
862
886
|
## Credits
|
863
887
|
|
864
|
-
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [
|
888
|
+
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS.
|
865
889
|
|
866
890
|
## License
|
867
891
|
|
package/dist/axios.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* axios v0.21.3 | (c) 2021 by Matt Zabriskie */
|
2
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
3
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
4
3
|
module.exports = factory();
|
@@ -8,7 +7,7 @@
|
|
8
7
|
exports["axios"] = factory();
|
9
8
|
else
|
10
9
|
root["axios"] = factory();
|
11
|
-
})(
|
10
|
+
})(this, function() {
|
12
11
|
return /******/ (function(modules) { // webpackBootstrap
|
13
12
|
/******/ // The module cache
|
14
13
|
/******/ var installedModules = {};
|
@@ -126,12 +125,24 @@ var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./lib/core
|
|
126
125
|
var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./lib/helpers/parseHeaders.js");
|
127
126
|
var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./lib/helpers/isURLSameOrigin.js");
|
128
127
|
var createError = __webpack_require__(/*! ../core/createError */ "./lib/core/createError.js");
|
128
|
+
var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults.js");
|
129
|
+
var Cancel = __webpack_require__(/*! ../cancel/Cancel */ "./lib/cancel/Cancel.js");
|
129
130
|
|
130
131
|
module.exports = function xhrAdapter(config) {
|
131
132
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
132
133
|
var requestData = config.data;
|
133
134
|
var requestHeaders = config.headers;
|
134
135
|
var responseType = config.responseType;
|
136
|
+
var onCanceled;
|
137
|
+
function done() {
|
138
|
+
if (config.cancelToken) {
|
139
|
+
config.cancelToken.unsubscribe(onCanceled);
|
140
|
+
}
|
141
|
+
|
142
|
+
if (config.signal) {
|
143
|
+
config.signal.removeEventListener('abort', onCanceled);
|
144
|
+
}
|
145
|
+
}
|
135
146
|
|
136
147
|
if (utils.isFormData(requestData)) {
|
137
148
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
@@ -169,7 +180,13 @@ module.exports = function xhrAdapter(config) {
|
|
169
180
|
request: request
|
170
181
|
};
|
171
182
|
|
172
|
-
settle(
|
183
|
+
settle(function _resolve(value) {
|
184
|
+
resolve(value);
|
185
|
+
done();
|
186
|
+
}, function _reject(err) {
|
187
|
+
reject(err);
|
188
|
+
done();
|
189
|
+
}, response);
|
173
190
|
|
174
191
|
// Clean up request
|
175
192
|
request = null;
|
@@ -222,14 +239,15 @@ module.exports = function xhrAdapter(config) {
|
|
222
239
|
|
223
240
|
// Handle timeout
|
224
241
|
request.ontimeout = function handleTimeout() {
|
225
|
-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
242
|
+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
243
|
+
var transitional = config.transitional || defaults.transitional;
|
226
244
|
if (config.timeoutErrorMessage) {
|
227
245
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
228
246
|
}
|
229
247
|
reject(createError(
|
230
248
|
timeoutErrorMessage,
|
231
249
|
config,
|
232
|
-
|
250
|
+
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
233
251
|
request));
|
234
252
|
|
235
253
|
// Clean up request
|
@@ -283,18 +301,22 @@ module.exports = function xhrAdapter(config) {
|
|
283
301
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
284
302
|
}
|
285
303
|
|
286
|
-
if (config.cancelToken) {
|
304
|
+
if (config.cancelToken || config.signal) {
|
287
305
|
// Handle cancellation
|
288
|
-
|
306
|
+
// eslint-disable-next-line func-names
|
307
|
+
onCanceled = function(cancel) {
|
289
308
|
if (!request) {
|
290
309
|
return;
|
291
310
|
}
|
292
|
-
|
311
|
+
reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
|
293
312
|
request.abort();
|
294
|
-
reject(cancel);
|
295
|
-
// Clean up request
|
296
313
|
request = null;
|
297
|
-
}
|
314
|
+
};
|
315
|
+
|
316
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
317
|
+
if (config.signal) {
|
318
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
319
|
+
}
|
298
320
|
}
|
299
321
|
|
300
322
|
if (!requestData) {
|
@@ -341,6 +363,11 @@ function createInstance(defaultConfig) {
|
|
341
363
|
// Copy context to instance
|
342
364
|
utils.extend(instance, context);
|
343
365
|
|
366
|
+
// Factory for creating new instances
|
367
|
+
instance.create = function create(instanceConfig) {
|
368
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
369
|
+
};
|
370
|
+
|
344
371
|
return instance;
|
345
372
|
}
|
346
373
|
|
@@ -350,15 +377,11 @@ var axios = createInstance(defaults);
|
|
350
377
|
// Expose Axios class to allow class inheritance
|
351
378
|
axios.Axios = Axios;
|
352
379
|
|
353
|
-
// Factory for creating new instances
|
354
|
-
axios.create = function create(instanceConfig) {
|
355
|
-
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
356
|
-
};
|
357
|
-
|
358
380
|
// Expose Cancel & CancelToken
|
359
381
|
axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./lib/cancel/Cancel.js");
|
360
382
|
axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./lib/cancel/CancelToken.js");
|
361
383
|
axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./lib/cancel/isCancel.js");
|
384
|
+
axios.VERSION = __webpack_require__(/*! ./env/data */ "./lib/env/data.js").version;
|
362
385
|
|
363
386
|
// Expose all/spread
|
364
387
|
axios.all = function all(promises) {
|
@@ -432,11 +455,42 @@ function CancelToken(executor) {
|
|
432
455
|
}
|
433
456
|
|
434
457
|
var resolvePromise;
|
458
|
+
|
435
459
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
436
460
|
resolvePromise = resolve;
|
437
461
|
});
|
438
462
|
|
439
463
|
var token = this;
|
464
|
+
|
465
|
+
// eslint-disable-next-line func-names
|
466
|
+
this.promise.then(function(cancel) {
|
467
|
+
if (!token._listeners) return;
|
468
|
+
|
469
|
+
var i;
|
470
|
+
var l = token._listeners.length;
|
471
|
+
|
472
|
+
for (i = 0; i < l; i++) {
|
473
|
+
token._listeners[i](cancel);
|
474
|
+
}
|
475
|
+
token._listeners = null;
|
476
|
+
});
|
477
|
+
|
478
|
+
// eslint-disable-next-line func-names
|
479
|
+
this.promise.then = function(onfulfilled) {
|
480
|
+
var _resolve;
|
481
|
+
// eslint-disable-next-line func-names
|
482
|
+
var promise = new Promise(function(resolve) {
|
483
|
+
token.subscribe(resolve);
|
484
|
+
_resolve = resolve;
|
485
|
+
}).then(onfulfilled);
|
486
|
+
|
487
|
+
promise.cancel = function reject() {
|
488
|
+
token.unsubscribe(_resolve);
|
489
|
+
};
|
490
|
+
|
491
|
+
return promise;
|
492
|
+
};
|
493
|
+
|
440
494
|
executor(function cancel(message) {
|
441
495
|
if (token.reason) {
|
442
496
|
// Cancellation has already been requested
|
@@ -457,6 +511,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
457
511
|
}
|
458
512
|
};
|
459
513
|
|
514
|
+
/**
|
515
|
+
* Subscribe to the cancel signal
|
516
|
+
*/
|
517
|
+
|
518
|
+
CancelToken.prototype.subscribe = function subscribe(listener) {
|
519
|
+
if (this.reason) {
|
520
|
+
listener(this.reason);
|
521
|
+
return;
|
522
|
+
}
|
523
|
+
|
524
|
+
if (this._listeners) {
|
525
|
+
this._listeners.push(listener);
|
526
|
+
} else {
|
527
|
+
this._listeners = [listener];
|
528
|
+
}
|
529
|
+
};
|
530
|
+
|
531
|
+
/**
|
532
|
+
* Unsubscribe from the cancel signal
|
533
|
+
*/
|
534
|
+
|
535
|
+
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
536
|
+
if (!this._listeners) {
|
537
|
+
return;
|
538
|
+
}
|
539
|
+
var index = this._listeners.indexOf(listener);
|
540
|
+
if (index !== -1) {
|
541
|
+
this._listeners.splice(index, 1);
|
542
|
+
}
|
543
|
+
};
|
544
|
+
|
460
545
|
/**
|
461
546
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
462
547
|
* cancels the `CancelToken`.
|
@@ -555,9 +640,9 @@ Axios.prototype.request = function request(config) {
|
|
555
640
|
|
556
641
|
if (transitional !== undefined) {
|
557
642
|
validator.assertOptions(transitional, {
|
558
|
-
silentJSONParsing: validators.transitional(validators.boolean
|
559
|
-
forcedJSONParsing: validators.transitional(validators.boolean
|
560
|
-
clarifyTimeoutError: validators.transitional(validators.boolean
|
643
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
644
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
645
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
561
646
|
}, false);
|
562
647
|
}
|
563
648
|
|
@@ -796,6 +881,7 @@ var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
|
|
796
881
|
var transformData = __webpack_require__(/*! ./transformData */ "./lib/core/transformData.js");
|
797
882
|
var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./lib/cancel/isCancel.js");
|
798
883
|
var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults.js");
|
884
|
+
var Cancel = __webpack_require__(/*! ../cancel/Cancel */ "./lib/cancel/Cancel.js");
|
799
885
|
|
800
886
|
/**
|
801
887
|
* Throws a `Cancel` if cancellation has been requested.
|
@@ -804,6 +890,10 @@ function throwIfCancellationRequested(config) {
|
|
804
890
|
if (config.cancelToken) {
|
805
891
|
config.cancelToken.throwIfRequested();
|
806
892
|
}
|
893
|
+
|
894
|
+
if (config.signal && config.signal.aborted) {
|
895
|
+
throw new Cancel('canceled');
|
896
|
+
}
|
807
897
|
}
|
808
898
|
|
809
899
|
/**
|
@@ -921,7 +1011,8 @@ module.exports = function enhanceError(error, config, code, request, response) {
|
|
921
1011
|
stack: this.stack,
|
922
1012
|
// Axios
|
923
1013
|
config: this.config,
|
924
|
-
code: this.code
|
1014
|
+
code: this.code,
|
1015
|
+
status: this.response && this.response.status ? this.response.status : null
|
925
1016
|
};
|
926
1017
|
};
|
927
1018
|
return error;
|
@@ -955,17 +1046,6 @@ module.exports = function mergeConfig(config1, config2) {
|
|
955
1046
|
config2 = config2 || {};
|
956
1047
|
var config = {};
|
957
1048
|
|
958
|
-
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
959
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
960
|
-
var defaultToConfig2Keys = [
|
961
|
-
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
962
|
-
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
963
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
964
|
-
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
965
|
-
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
966
|
-
];
|
967
|
-
var directMergeKeys = ['validateStatus'];
|
968
|
-
|
969
1049
|
function getMergedValue(target, source) {
|
970
1050
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
971
1051
|
return utils.merge(target, source);
|
@@ -977,51 +1057,74 @@ module.exports = function mergeConfig(config1, config2) {
|
|
977
1057
|
return source;
|
978
1058
|
}
|
979
1059
|
|
1060
|
+
// eslint-disable-next-line consistent-return
|
980
1061
|
function mergeDeepProperties(prop) {
|
981
1062
|
if (!utils.isUndefined(config2[prop])) {
|
982
|
-
|
1063
|
+
return getMergedValue(config1[prop], config2[prop]);
|
983
1064
|
} else if (!utils.isUndefined(config1[prop])) {
|
984
|
-
|
1065
|
+
return getMergedValue(undefined, config1[prop]);
|
985
1066
|
}
|
986
1067
|
}
|
987
1068
|
|
988
|
-
|
1069
|
+
// eslint-disable-next-line consistent-return
|
1070
|
+
function valueFromConfig2(prop) {
|
989
1071
|
if (!utils.isUndefined(config2[prop])) {
|
990
|
-
|
1072
|
+
return getMergedValue(undefined, config2[prop]);
|
991
1073
|
}
|
992
|
-
}
|
993
|
-
|
994
|
-
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
1074
|
+
}
|
995
1075
|
|
996
|
-
|
1076
|
+
// eslint-disable-next-line consistent-return
|
1077
|
+
function defaultToConfig2(prop) {
|
997
1078
|
if (!utils.isUndefined(config2[prop])) {
|
998
|
-
|
1079
|
+
return getMergedValue(undefined, config2[prop]);
|
999
1080
|
} else if (!utils.isUndefined(config1[prop])) {
|
1000
|
-
|
1081
|
+
return getMergedValue(undefined, config1[prop]);
|
1001
1082
|
}
|
1002
|
-
}
|
1083
|
+
}
|
1003
1084
|
|
1004
|
-
|
1085
|
+
// eslint-disable-next-line consistent-return
|
1086
|
+
function mergeDirectKeys(prop) {
|
1005
1087
|
if (prop in config2) {
|
1006
|
-
|
1088
|
+
return getMergedValue(config1[prop], config2[prop]);
|
1007
1089
|
} else if (prop in config1) {
|
1008
|
-
|
1090
|
+
return getMergedValue(undefined, config1[prop]);
|
1009
1091
|
}
|
1010
|
-
}
|
1011
|
-
|
1012
|
-
var axiosKeys = valueFromConfig2Keys
|
1013
|
-
.concat(mergeDeepPropertiesKeys)
|
1014
|
-
.concat(defaultToConfig2Keys)
|
1015
|
-
.concat(directMergeKeys);
|
1092
|
+
}
|
1016
1093
|
|
1017
|
-
var
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1094
|
+
var mergeMap = {
|
1095
|
+
'url': valueFromConfig2,
|
1096
|
+
'method': valueFromConfig2,
|
1097
|
+
'data': valueFromConfig2,
|
1098
|
+
'baseURL': defaultToConfig2,
|
1099
|
+
'transformRequest': defaultToConfig2,
|
1100
|
+
'transformResponse': defaultToConfig2,
|
1101
|
+
'paramsSerializer': defaultToConfig2,
|
1102
|
+
'timeout': defaultToConfig2,
|
1103
|
+
'timeoutMessage': defaultToConfig2,
|
1104
|
+
'withCredentials': defaultToConfig2,
|
1105
|
+
'adapter': defaultToConfig2,
|
1106
|
+
'responseType': defaultToConfig2,
|
1107
|
+
'xsrfCookieName': defaultToConfig2,
|
1108
|
+
'xsrfHeaderName': defaultToConfig2,
|
1109
|
+
'onUploadProgress': defaultToConfig2,
|
1110
|
+
'onDownloadProgress': defaultToConfig2,
|
1111
|
+
'decompress': defaultToConfig2,
|
1112
|
+
'maxContentLength': defaultToConfig2,
|
1113
|
+
'maxBodyLength': defaultToConfig2,
|
1114
|
+
'transport': defaultToConfig2,
|
1115
|
+
'httpAgent': defaultToConfig2,
|
1116
|
+
'httpsAgent': defaultToConfig2,
|
1117
|
+
'cancelToken': defaultToConfig2,
|
1118
|
+
'socketPath': defaultToConfig2,
|
1119
|
+
'responseEncoding': defaultToConfig2,
|
1120
|
+
'validateStatus': mergeDirectKeys
|
1121
|
+
};
|
1023
1122
|
|
1024
|
-
utils.forEach(
|
1123
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
1124
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
1125
|
+
var configValue = merge(prop);
|
1126
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
1127
|
+
});
|
1025
1128
|
|
1026
1129
|
return config;
|
1027
1130
|
};
|
@@ -1136,6 +1239,21 @@ function getDefaultAdapter() {
|
|
1136
1239
|
return adapter;
|
1137
1240
|
}
|
1138
1241
|
|
1242
|
+
function stringifySafely(rawValue, parser, encoder) {
|
1243
|
+
if (utils.isString(rawValue)) {
|
1244
|
+
try {
|
1245
|
+
(parser || JSON.parse)(rawValue);
|
1246
|
+
return utils.trim(rawValue);
|
1247
|
+
} catch (e) {
|
1248
|
+
if (e.name !== 'SyntaxError') {
|
1249
|
+
throw e;
|
1250
|
+
}
|
1251
|
+
}
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
return (encoder || JSON.stringify)(rawValue);
|
1255
|
+
}
|
1256
|
+
|
1139
1257
|
var defaults = {
|
1140
1258
|
|
1141
1259
|
transitional: {
|
@@ -1168,13 +1286,13 @@ var defaults = {
|
|
1168
1286
|
}
|
1169
1287
|
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
1170
1288
|
setContentTypeIfUnset(headers, 'application/json');
|
1171
|
-
return
|
1289
|
+
return stringifySafely(data);
|
1172
1290
|
}
|
1173
1291
|
return data;
|
1174
1292
|
}],
|
1175
1293
|
|
1176
1294
|
transformResponse: [function transformResponse(data) {
|
1177
|
-
var transitional = this.transitional;
|
1295
|
+
var transitional = this.transitional || defaults.transitional;
|
1178
1296
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
1179
1297
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
1180
1298
|
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
@@ -1209,12 +1327,12 @@ var defaults = {
|
|
1209
1327
|
|
1210
1328
|
validateStatus: function validateStatus(status) {
|
1211
1329
|
return status >= 200 && status < 300;
|
1212
|
-
}
|
1213
|
-
};
|
1330
|
+
},
|
1214
1331
|
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1332
|
+
headers: {
|
1333
|
+
common: {
|
1334
|
+
'Accept': 'application/json, text/plain, */*'
|
1335
|
+
}
|
1218
1336
|
}
|
1219
1337
|
};
|
1220
1338
|
|
@@ -1229,6 +1347,19 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
1229
1347
|
module.exports = defaults;
|
1230
1348
|
|
1231
1349
|
|
1350
|
+
/***/ }),
|
1351
|
+
|
1352
|
+
/***/ "./lib/env/data.js":
|
1353
|
+
/*!*************************!*\
|
1354
|
+
!*** ./lib/env/data.js ***!
|
1355
|
+
\*************************/
|
1356
|
+
/*! no static exports found */
|
1357
|
+
/***/ (function(module, exports) {
|
1358
|
+
|
1359
|
+
module.exports = {
|
1360
|
+
"version": "0.24.0"
|
1361
|
+
};
|
1362
|
+
|
1232
1363
|
/***/ }),
|
1233
1364
|
|
1234
1365
|
/***/ "./lib/helpers/bind.js":
|
@@ -1694,7 +1825,7 @@ module.exports = function spread(callback) {
|
|
1694
1825
|
"use strict";
|
1695
1826
|
|
1696
1827
|
|
1697
|
-
var
|
1828
|
+
var VERSION = __webpack_require__(/*! ../env/data */ "./lib/env/data.js").version;
|
1698
1829
|
|
1699
1830
|
var validators = {};
|
1700
1831
|
|
@@ -1706,48 +1837,26 @@ var validators = {};
|
|
1706
1837
|
});
|
1707
1838
|
|
1708
1839
|
var deprecatedWarnings = {};
|
1709
|
-
var currentVerArr = pkg.version.split('.');
|
1710
|
-
|
1711
|
-
/**
|
1712
|
-
* Compare package versions
|
1713
|
-
* @param {string} version
|
1714
|
-
* @param {string?} thanVersion
|
1715
|
-
* @returns {boolean}
|
1716
|
-
*/
|
1717
|
-
function isOlderVersion(version, thanVersion) {
|
1718
|
-
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
1719
|
-
var destVer = version.split('.');
|
1720
|
-
for (var i = 0; i < 3; i++) {
|
1721
|
-
if (pkgVersionArr[i] > destVer[i]) {
|
1722
|
-
return true;
|
1723
|
-
} else if (pkgVersionArr[i] < destVer[i]) {
|
1724
|
-
return false;
|
1725
|
-
}
|
1726
|
-
}
|
1727
|
-
return false;
|
1728
|
-
}
|
1729
1840
|
|
1730
1841
|
/**
|
1731
1842
|
* Transitional option validator
|
1732
|
-
* @param {function|boolean?} validator
|
1733
|
-
* @param {string?} version
|
1734
|
-
* @param {string} message
|
1843
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
1844
|
+
* @param {string?} version - deprecated version / removed since version
|
1845
|
+
* @param {string?} message - some message with additional info
|
1735
1846
|
* @returns {function}
|
1736
1847
|
*/
|
1737
1848
|
validators.transitional = function transitional(validator, version, message) {
|
1738
|
-
var isDeprecated = version && isOlderVersion(version);
|
1739
|
-
|
1740
1849
|
function formatMessage(opt, desc) {
|
1741
|
-
return '[Axios v' +
|
1850
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
1742
1851
|
}
|
1743
1852
|
|
1744
1853
|
// eslint-disable-next-line func-names
|
1745
1854
|
return function(value, opt, opts) {
|
1746
1855
|
if (validator === false) {
|
1747
|
-
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
1856
|
+
throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
|
1748
1857
|
}
|
1749
1858
|
|
1750
|
-
if (
|
1859
|
+
if (version && !deprecatedWarnings[opt]) {
|
1751
1860
|
deprecatedWarnings[opt] = true;
|
1752
1861
|
// eslint-disable-next-line no-console
|
1753
1862
|
console.warn(
|
@@ -1793,7 +1902,6 @@ function assertOptions(options, schema, allowUnknown) {
|
|
1793
1902
|
}
|
1794
1903
|
|
1795
1904
|
module.exports = {
|
1796
|
-
isOlderVersion: isOlderVersion,
|
1797
1905
|
assertOptions: assertOptions,
|
1798
1906
|
validators: validators
|
1799
1907
|
};
|
@@ -2160,17 +2268,6 @@ module.exports = {
|
|
2160
2268
|
};
|
2161
2269
|
|
2162
2270
|
|
2163
|
-
/***/ }),
|
2164
|
-
|
2165
|
-
/***/ "./package.json":
|
2166
|
-
/*!**********************!*\
|
2167
|
-
!*** ./package.json ***!
|
2168
|
-
\**********************/
|
2169
|
-
/*! exports provided: name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, browser, jsdelivr, unpkg, typings, dependencies, bundlesize, default */
|
2170
|
-
/***/ (function(module) {
|
2171
|
-
|
2172
|
-
module.exports = JSON.parse("{\"name\":\"axios\",\"version\":\"0.21.3\",\"description\":\"Promise based HTTP client for the browser and node.js\",\"main\":\"index.js\",\"scripts\":{\"test\":\"grunt test\",\"start\":\"node ./sandbox/server.js\",\"build\":\"NODE_ENV=production grunt build\",\"preversion\":\"npm test\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\",\"postversion\":\"git push && git push --tags\",\"examples\":\"node ./examples/server.js\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"fix\":\"eslint --fix lib/**/*.js\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/axios/axios.git\"},\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"author\":\"Matt Zabriskie\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"homepage\":\"https://axios-http.com\",\"devDependencies\":{\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.3.0\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^23.0.0\",\"grunt-karma\":\"^4.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^4.0.2\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^6.3.2\",\"karma-chrome-launcher\":\"^3.1.0\",\"karma-firefox-launcher\":\"^2.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^4.3.6\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.8\",\"karma-webpack\":\"^4.0.2\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^8.2.1\",\"sinon\":\"^4.5.0\",\"terser-webpack-plugin\":\"^4.2.3\",\"typescript\":\"^4.0.5\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^4.44.2\",\"webpack-dev-server\":\"^3.11.0\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"jsdelivr\":\"dist/axios.min.js\",\"unpkg\":\"dist/axios.min.js\",\"typings\":\"./index.d.ts\",\"dependencies\":{\"follow-redirects\":\"^1.14.0\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}]}");
|
2173
|
-
|
2174
2271
|
/***/ })
|
2175
2272
|
|
2176
2273
|
/******/ });
|