axios 1.8.0 → 1.8.2
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 +22 -0
- package/README.md +2 -2
- package/dist/axios.js +6 -31
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +2 -32
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +2 -28
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +32 -31
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/http.js +1 -1
- 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 -25
- package/package.json +1 -1
package/lib/adapters/http.js
CHANGED
@@ -228,7 +228,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
228
228
|
}
|
229
229
|
|
230
230
|
// Parse url
|
231
|
-
const fullPath = buildFullPath(config.baseURL, config.url);
|
231
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
232
232
|
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
233
233
|
const protocol = parsed.protocol || supportedProtocols[0];
|
234
234
|
|
package/lib/env/data.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "1.8.
|
1
|
+
export const VERSION = "1.8.2";
|
@@ -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
@@ -1,7 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
import bind from './helpers/bind.js';
|
4
|
-
import crypto from 'crypto';
|
5
4
|
|
6
5
|
// utils is a library of generic helper functions non-specific to axios
|
7
6
|
|
@@ -603,28 +602,6 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
603
602
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
604
603
|
}
|
605
604
|
|
606
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
607
|
-
|
608
|
-
const DIGIT = '0123456789';
|
609
|
-
|
610
|
-
const ALPHABET = {
|
611
|
-
DIGIT,
|
612
|
-
ALPHA,
|
613
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
614
|
-
}
|
615
|
-
|
616
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
617
|
-
let str = '';
|
618
|
-
const {length} = alphabet;
|
619
|
-
const randomValues = new Uint32Array(size);
|
620
|
-
crypto.randomFillSync(randomValues);
|
621
|
-
for (let i = 0; i < size; i++) {
|
622
|
-
str += alphabet[randomValues[i] % length];
|
623
|
-
}
|
624
|
-
|
625
|
-
return str;
|
626
|
-
}
|
627
|
-
|
628
605
|
/**
|
629
606
|
* If the thing is a FormData object, return true, otherwise return false.
|
630
607
|
*
|
@@ -752,8 +729,6 @@ export default {
|
|
752
729
|
findKey,
|
753
730
|
global: _global,
|
754
731
|
isContextDefined,
|
755
|
-
ALPHABET,
|
756
|
-
generateString,
|
757
732
|
isSpecCompliantForm,
|
758
733
|
toJSONObject,
|
759
734
|
isAsyncFn,
|