axios 1.7.7 → 1.7.8
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 +38 -0
- package/README.md +20 -8
- package/dist/axios.js +34 -63
- 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 +40 -71
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +40 -71
- 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 +45 -75
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +38 -29
- package/index.d.ts +75 -561
- package/lib/adapters/http.js +4 -4
- package/lib/core/Axios.js +7 -2
- package/lib/core/mergeConfig.js +5 -5
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +7 -1
- package/lib/helpers/formDataToStream.js +2 -2
- package/lib/helpers/isURLSameOrigin.js +12 -65
- package/lib/helpers/validator.js +8 -0
- package/package.json +3 -3
package/lib/core/mergeConfig.js
CHANGED
@@ -19,7 +19,7 @@ export default function mergeConfig(config1, config2) {
|
|
19
19
|
config2 = config2 || {};
|
20
20
|
const config = {};
|
21
21
|
|
22
|
-
function getMergedValue(target, source, caseless) {
|
22
|
+
function getMergedValue(target, source, prop, caseless) {
|
23
23
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
24
24
|
return utils.merge.call({caseless}, target, source);
|
25
25
|
} else if (utils.isPlainObject(source)) {
|
@@ -31,11 +31,11 @@ export default function mergeConfig(config1, config2) {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
// eslint-disable-next-line consistent-return
|
34
|
-
function mergeDeepProperties(a, b, caseless) {
|
34
|
+
function mergeDeepProperties(a, b, prop , caseless) {
|
35
35
|
if (!utils.isUndefined(b)) {
|
36
|
-
return getMergedValue(a, b, caseless);
|
36
|
+
return getMergedValue(a, b, prop , caseless);
|
37
37
|
} else if (!utils.isUndefined(a)) {
|
38
|
-
return getMergedValue(undefined, a, caseless);
|
38
|
+
return getMergedValue(undefined, a, prop , caseless);
|
39
39
|
}
|
40
40
|
}
|
41
41
|
|
@@ -93,7 +93,7 @@ export default function mergeConfig(config1, config2) {
|
|
93
93
|
socketPath: defaultToConfig2,
|
94
94
|
responseEncoding: defaultToConfig2,
|
95
95
|
validateStatus: mergeDirectKeys,
|
96
|
-
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
96
|
+
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
97
97
|
};
|
98
98
|
|
99
99
|
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
package/lib/env/data.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "1.7.
|
1
|
+
export const VERSION = "1.7.8";
|
package/lib/helpers/buildURL.js
CHANGED
@@ -26,7 +26,7 @@ function encode(val) {
|
|
26
26
|
*
|
27
27
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
28
28
|
* @param {object} [params] The params to be appended
|
29
|
-
* @param {?object} options
|
29
|
+
* @param {?(object|Function)} options
|
30
30
|
*
|
31
31
|
* @returns {string} The formatted url
|
32
32
|
*/
|
@@ -38,6 +38,12 @@ export default function buildURL(url, params, options) {
|
|
38
38
|
|
39
39
|
const _encode = options && options.encode || encode;
|
40
40
|
|
41
|
+
if (utils.isFunction(options)) {
|
42
|
+
options = {
|
43
|
+
serialize: options
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
41
47
|
const serializeFn = options && options.serialize;
|
42
48
|
|
43
49
|
let serializedParams;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import util from 'util';
|
2
2
|
import {Readable} from 'stream';
|
3
3
|
import utils from "../utils.js";
|
4
4
|
import readBlob from "./readBlob.js";
|
5
5
|
|
6
6
|
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
|
7
7
|
|
8
|
-
const textEncoder = new TextEncoder();
|
8
|
+
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
|
9
9
|
|
10
10
|
const CRLF = '\r\n';
|
11
11
|
const CRLF_BYTES = textEncoder.encode(CRLF);
|
@@ -1,67 +1,14 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
import utils from './../utils.js';
|
4
1
|
import platform from '../platform/index.js';
|
5
2
|
|
6
|
-
export default platform.hasStandardBrowserEnv ?
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
* @param {String} url The URL to be parsed
|
19
|
-
* @returns {Object}
|
20
|
-
*/
|
21
|
-
function resolveURL(url) {
|
22
|
-
let href = url;
|
23
|
-
|
24
|
-
if (msie) {
|
25
|
-
// IE needs attribute set twice to normalize properties
|
26
|
-
urlParsingNode.setAttribute('href', href);
|
27
|
-
href = urlParsingNode.href;
|
28
|
-
}
|
29
|
-
|
30
|
-
urlParsingNode.setAttribute('href', href);
|
31
|
-
|
32
|
-
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
33
|
-
return {
|
34
|
-
href: urlParsingNode.href,
|
35
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
36
|
-
host: urlParsingNode.host,
|
37
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
38
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
39
|
-
hostname: urlParsingNode.hostname,
|
40
|
-
port: urlParsingNode.port,
|
41
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
42
|
-
urlParsingNode.pathname :
|
43
|
-
'/' + urlParsingNode.pathname
|
44
|
-
};
|
45
|
-
}
|
46
|
-
|
47
|
-
originURL = resolveURL(window.location.href);
|
48
|
-
|
49
|
-
/**
|
50
|
-
* Determine if a URL shares the same origin as the current location
|
51
|
-
*
|
52
|
-
* @param {String} requestURL The URL to test
|
53
|
-
* @returns {boolean} True if URL shares the same origin, otherwise false
|
54
|
-
*/
|
55
|
-
return function isURLSameOrigin(requestURL) {
|
56
|
-
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
57
|
-
return (parsed.protocol === originURL.protocol &&
|
58
|
-
parsed.host === originURL.host);
|
59
|
-
};
|
60
|
-
})() :
|
61
|
-
|
62
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
63
|
-
(function nonStandardBrowserEnv() {
|
64
|
-
return function isURLSameOrigin() {
|
65
|
-
return true;
|
66
|
-
};
|
67
|
-
})();
|
3
|
+
export default platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
4
|
+
url = new URL(url, platform.origin);
|
5
|
+
|
6
|
+
return (
|
7
|
+
origin.protocol === url.protocol &&
|
8
|
+
origin.host === url.host &&
|
9
|
+
(isMSIE || origin.port === url.port)
|
10
|
+
);
|
11
|
+
})(
|
12
|
+
new URL(platform.origin),
|
13
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
14
|
+
) : () => true;
|
package/lib/helpers/validator.js
CHANGED
@@ -52,6 +52,14 @@ validators.transitional = function transitional(validator, version, message) {
|
|
52
52
|
};
|
53
53
|
};
|
54
54
|
|
55
|
+
validators.spelling = function spelling(correctSpelling) {
|
56
|
+
return (value, opt) => {
|
57
|
+
// eslint-disable-next-line no-console
|
58
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
55
63
|
/**
|
56
64
|
* Assert object's properties type
|
57
65
|
*
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "axios",
|
3
|
-
"version": "1.7.
|
3
|
+
"version": "1.7.8",
|
4
4
|
"description": "Promise based HTTP client for the browser and node.js",
|
5
5
|
"main": "index.js",
|
6
6
|
"exports": {
|
@@ -163,12 +163,12 @@
|
|
163
163
|
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
|
164
164
|
"Jay (https://github.com/jasonsaayman)",
|
165
165
|
"Emily Morehouse (https://github.com/emilyemorehouse)",
|
166
|
-
"Rubén Norte (https://github.com/rubennorte)",
|
167
166
|
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
167
|
+
"Rubén Norte (https://github.com/rubennorte)",
|
168
168
|
"Martti Laine (https://github.com/codeclown)",
|
169
169
|
"Xianming Zhong (https://github.com/chinesedfan)",
|
170
|
-
"Rikki Gibson (https://github.com/RikkiGibson)",
|
171
170
|
"Remco Haszing (https://github.com/remcohaszing)",
|
171
|
+
"Rikki Gibson (https://github.com/RikkiGibson)",
|
172
172
|
"Yasu Flores (https://github.com/yasuf)",
|
173
173
|
"Ben Carp (https://github.com/carpben)"
|
174
174
|
],
|