axios 1.7.9 → 1.8.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.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +61 -0
- package/README.md +30 -14
- package/dist/axios.js +13 -24
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +2 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +13 -27
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +13 -27
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +2 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +42 -29
- package/dist/node/axios.cjs.map +1 -1
- package/lib/core/Axios.js +10 -1
- package/lib/core/buildFullPath.js +3 -2
- package/lib/env/data.js +1 -1
- package/lib/helpers/formDataToStream.js +3 -2
- package/lib/platform/node/index.js +26 -0
- package/lib/utils.js +0 -22
- package/package.json +3 -3
- package/SECURITY.md +0 -6
package/lib/core/Axios.js
CHANGED
@@ -97,6 +97,15 @@ class Axios {
|
|
97
97
|
}
|
98
98
|
}
|
99
99
|
|
100
|
+
// Set config.allowAbsoluteUrls
|
101
|
+
if (config.allowAbsoluteUrls !== undefined) {
|
102
|
+
// do nothing
|
103
|
+
} else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
104
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
105
|
+
} else {
|
106
|
+
config.allowAbsoluteUrls = true;
|
107
|
+
}
|
108
|
+
|
100
109
|
validator.assertOptions(config, {
|
101
110
|
baseUrl: validators.spelling('baseURL'),
|
102
111
|
withXsrfToken: validators.spelling('withXSRFToken')
|
@@ -192,7 +201,7 @@ class Axios {
|
|
192
201
|
|
193
202
|
getUri(config) {
|
194
203
|
config = mergeConfig(this.defaults, config);
|
195
|
-
const fullPath = buildFullPath(config.baseURL, config.url);
|
204
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
196
205
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
197
206
|
}
|
198
207
|
}
|
@@ -13,8 +13,9 @@ import combineURLs from '../helpers/combineURLs.js';
|
|
13
13
|
*
|
14
14
|
* @returns {string} The combined full path
|
15
15
|
*/
|
16
|
-
export default function buildFullPath(baseURL, requestedURL) {
|
17
|
-
|
16
|
+
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
17
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
18
|
+
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
|
18
19
|
return combineURLs(baseURL, requestedURL);
|
19
20
|
}
|
20
21
|
return requestedURL;
|
package/lib/env/data.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "1.
|
1
|
+
export const VERSION = "1.8.1";
|
@@ -2,8 +2,9 @@ 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
|
+
import platform from "../platform/index.js";
|
5
6
|
|
6
|
-
const BOUNDARY_ALPHABET =
|
7
|
+
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
|
7
8
|
|
8
9
|
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
|
9
10
|
|
@@ -63,7 +64,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
63
64
|
const {
|
64
65
|
tag = 'form-data-boundary',
|
65
66
|
size = 25,
|
66
|
-
boundary = tag + '-' +
|
67
|
+
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
|
67
68
|
} = options || {};
|
68
69
|
|
69
70
|
if(!utils.isFormData(form)) {
|
@@ -1,6 +1,30 @@
|
|
1
|
+
import crypto from 'crypto';
|
1
2
|
import URLSearchParams from './classes/URLSearchParams.js'
|
2
3
|
import FormData from './classes/FormData.js'
|
3
4
|
|
5
|
+
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
6
|
+
|
7
|
+
const DIGIT = '0123456789';
|
8
|
+
|
9
|
+
const ALPHABET = {
|
10
|
+
DIGIT,
|
11
|
+
ALPHA,
|
12
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
13
|
+
}
|
14
|
+
|
15
|
+
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
16
|
+
let str = '';
|
17
|
+
const {length} = alphabet;
|
18
|
+
const randomValues = new Uint32Array(size);
|
19
|
+
crypto.randomFillSync(randomValues);
|
20
|
+
for (let i = 0; i < size; i++) {
|
21
|
+
str += alphabet[randomValues[i] % length];
|
22
|
+
}
|
23
|
+
|
24
|
+
return str;
|
25
|
+
}
|
26
|
+
|
27
|
+
|
4
28
|
export default {
|
5
29
|
isNode: true,
|
6
30
|
classes: {
|
@@ -8,5 +32,7 @@ export default {
|
|
8
32
|
FormData,
|
9
33
|
Blob: typeof Blob !== 'undefined' && Blob || null
|
10
34
|
},
|
35
|
+
ALPHABET,
|
36
|
+
generateString,
|
11
37
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
12
38
|
};
|
package/lib/utils.js
CHANGED
@@ -602,26 +602,6 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
602
602
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
603
603
|
}
|
604
604
|
|
605
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
606
|
-
|
607
|
-
const DIGIT = '0123456789';
|
608
|
-
|
609
|
-
const ALPHABET = {
|
610
|
-
DIGIT,
|
611
|
-
ALPHA,
|
612
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
613
|
-
}
|
614
|
-
|
615
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
616
|
-
let str = '';
|
617
|
-
const {length} = alphabet;
|
618
|
-
while (size--) {
|
619
|
-
str += alphabet[Math.random() * length|0]
|
620
|
-
}
|
621
|
-
|
622
|
-
return str;
|
623
|
-
}
|
624
|
-
|
625
605
|
/**
|
626
606
|
* If the thing is a FormData object, return true, otherwise return false.
|
627
607
|
*
|
@@ -749,8 +729,6 @@ export default {
|
|
749
729
|
findKey,
|
750
730
|
global: _global,
|
751
731
|
isContextDefined,
|
752
|
-
ALPHABET,
|
753
|
-
generateString,
|
754
732
|
isSpecCompliantForm,
|
755
733
|
toJSONObject,
|
756
734
|
isAsyncFn,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "axios",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.8.1",
|
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
|
-
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
167
166
|
"Rubén Norte (https://github.com/rubennorte)",
|
167
|
+
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
168
168
|
"Martti Laine (https://github.com/codeclown)",
|
169
169
|
"Xianming Zhong (https://github.com/chinesedfan)",
|
170
|
-
"Remco Haszing (https://github.com/remcohaszing)",
|
171
170
|
"Rikki Gibson (https://github.com/RikkiGibson)",
|
171
|
+
"Remco Haszing (https://github.com/remcohaszing)",
|
172
172
|
"Yasu Flores (https://github.com/yasuf)",
|
173
173
|
"Ben Carp (https://github.com/carpben)"
|
174
174
|
],
|
package/SECURITY.md
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
# Reporting a Vulnerability
|
2
|
-
|
3
|
-
If you discover a security vulnerability in axios please disclose it via [our huntr page](https://huntr.dev/repos/axios/axios/). Bounty eligibility, CVE assignment, response times and past reports are all there.
|
4
|
-
|
5
|
-
|
6
|
-
Thank you for improving the security of axios.
|