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/dist/node/axios.cjs
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
1
|
+
/*! Axios v1.8.1 Copyright (c) 2025 Matt Zabriskie and contributors */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
const FormData$1 = require('form-data');
|
5
|
+
const crypto = require('crypto');
|
5
6
|
const url = require('url');
|
6
7
|
const proxyFromEnv = require('proxy-from-env');
|
7
8
|
const http = require('http');
|
@@ -15,6 +16,7 @@ const events = require('events');
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
16
17
|
|
17
18
|
const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
|
19
|
+
const crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
18
20
|
const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
|
19
21
|
const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
|
20
22
|
const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
@@ -630,26 +632,6 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
630
632
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
631
633
|
};
|
632
634
|
|
633
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
634
|
-
|
635
|
-
const DIGIT = '0123456789';
|
636
|
-
|
637
|
-
const ALPHABET = {
|
638
|
-
DIGIT,
|
639
|
-
ALPHA,
|
640
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
641
|
-
};
|
642
|
-
|
643
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
644
|
-
let str = '';
|
645
|
-
const {length} = alphabet;
|
646
|
-
while (size--) {
|
647
|
-
str += alphabet[Math.random() * length|0];
|
648
|
-
}
|
649
|
-
|
650
|
-
return str;
|
651
|
-
};
|
652
|
-
|
653
635
|
/**
|
654
636
|
* If the thing is a FormData object, return true, otherwise return false.
|
655
637
|
*
|
@@ -777,8 +759,6 @@ const utils$1 = {
|
|
777
759
|
findKey,
|
778
760
|
global: _global,
|
779
761
|
isContextDefined,
|
780
|
-
ALPHABET,
|
781
|
-
generateString,
|
782
762
|
isSpecCompliantForm,
|
783
763
|
toJSONObject,
|
784
764
|
isAsyncFn,
|
@@ -1290,6 +1270,29 @@ const transitionalDefaults = {
|
|
1290
1270
|
|
1291
1271
|
const URLSearchParams = url__default["default"].URLSearchParams;
|
1292
1272
|
|
1273
|
+
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
1274
|
+
|
1275
|
+
const DIGIT = '0123456789';
|
1276
|
+
|
1277
|
+
const ALPHABET = {
|
1278
|
+
DIGIT,
|
1279
|
+
ALPHA,
|
1280
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
1281
|
+
};
|
1282
|
+
|
1283
|
+
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
1284
|
+
let str = '';
|
1285
|
+
const {length} = alphabet;
|
1286
|
+
const randomValues = new Uint32Array(size);
|
1287
|
+
crypto__default["default"].randomFillSync(randomValues);
|
1288
|
+
for (let i = 0; i < size; i++) {
|
1289
|
+
str += alphabet[randomValues[i] % length];
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
return str;
|
1293
|
+
};
|
1294
|
+
|
1295
|
+
|
1293
1296
|
const platform$1 = {
|
1294
1297
|
isNode: true,
|
1295
1298
|
classes: {
|
@@ -1297,6 +1300,8 @@ const platform$1 = {
|
|
1297
1300
|
FormData: FormData__default["default"],
|
1298
1301
|
Blob: typeof Blob !== 'undefined' && Blob || null
|
1299
1302
|
},
|
1303
|
+
ALPHABET,
|
1304
|
+
generateString,
|
1300
1305
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
1301
1306
|
};
|
1302
1307
|
|
@@ -2071,14 +2076,15 @@ function combineURLs(baseURL, relativeURL) {
|
|
2071
2076
|
*
|
2072
2077
|
* @returns {string} The combined full path
|
2073
2078
|
*/
|
2074
|
-
function buildFullPath(baseURL, requestedURL) {
|
2075
|
-
|
2079
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
2080
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
2081
|
+
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
|
2076
2082
|
return combineURLs(baseURL, requestedURL);
|
2077
2083
|
}
|
2078
2084
|
return requestedURL;
|
2079
2085
|
}
|
2080
2086
|
|
2081
|
-
const VERSION = "1.
|
2087
|
+
const VERSION = "1.8.1";
|
2082
2088
|
|
2083
2089
|
function parseProtocol(url) {
|
2084
2090
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -2288,7 +2294,7 @@ const readBlob = async function* (blob) {
|
|
2288
2294
|
|
2289
2295
|
const readBlob$1 = readBlob;
|
2290
2296
|
|
2291
|
-
const BOUNDARY_ALPHABET =
|
2297
|
+
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
|
2292
2298
|
|
2293
2299
|
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util__default["default"].TextEncoder();
|
2294
2300
|
|
@@ -2348,7 +2354,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
2348
2354
|
const {
|
2349
2355
|
tag = 'form-data-boundary',
|
2350
2356
|
size = 25,
|
2351
|
-
boundary = tag + '-' +
|
2357
|
+
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
|
2352
2358
|
} = options || {};
|
2353
2359
|
|
2354
2360
|
if(!utils$1.isFormData(form)) {
|
@@ -4304,6 +4310,13 @@ class Axios {
|
|
4304
4310
|
}
|
4305
4311
|
}
|
4306
4312
|
|
4313
|
+
// Set config.allowAbsoluteUrls
|
4314
|
+
if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
4315
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
4316
|
+
} else {
|
4317
|
+
config.allowAbsoluteUrls = true;
|
4318
|
+
}
|
4319
|
+
|
4307
4320
|
validator.assertOptions(config, {
|
4308
4321
|
baseUrl: validators.spelling('baseURL'),
|
4309
4322
|
withXsrfToken: validators.spelling('withXSRFToken')
|
@@ -4399,7 +4412,7 @@ class Axios {
|
|
4399
4412
|
|
4400
4413
|
getUri(config) {
|
4401
4414
|
config = mergeConfig(this.defaults, config);
|
4402
|
-
const fullPath = buildFullPath(config.baseURL, config.url);
|
4415
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
4403
4416
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
4404
4417
|
}
|
4405
4418
|
}
|