axios 1.7.9 → 1.8.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.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

@@ -1,6 +1,12 @@
1
- // Axios v1.7.9 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ /*! Axios v1.8.0 Copyright (c) 2025 Matt Zabriskie and contributors */
2
2
  'use strict';
3
3
 
4
+ var crypto = require('crypto');
5
+
6
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
+
8
+ var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
9
+
4
10
  function bind(fn, thisArg) {
5
11
  return function wrap() {
6
12
  return fn.apply(thisArg, arguments);
@@ -620,8 +626,10 @@ const ALPHABET = {
620
626
  const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
621
627
  let str = '';
622
628
  const {length} = alphabet;
623
- while (size--) {
624
- str += alphabet[Math.random() * length|0];
629
+ const randomValues = new Uint32Array(size);
630
+ crypto__default["default"].randomFillSync(randomValues);
631
+ for (let i = 0; i < size; i++) {
632
+ str += alphabet[randomValues[i] % length];
625
633
  }
626
634
 
627
635
  return str;
@@ -2248,8 +2256,9 @@ function combineURLs(baseURL, relativeURL) {
2248
2256
  *
2249
2257
  * @returns {string} The combined full path
2250
2258
  */
2251
- function buildFullPath(baseURL, requestedURL) {
2252
- if (baseURL && !isAbsoluteURL(requestedURL)) {
2259
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2260
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
2261
+ if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
2253
2262
  return combineURLs(baseURL, requestedURL);
2254
2263
  }
2255
2264
  return requestedURL;
@@ -3089,7 +3098,7 @@ function dispatchRequest(config) {
3089
3098
  });
3090
3099
  }
3091
3100
 
3092
- const VERSION = "1.7.9";
3101
+ const VERSION = "1.8.0";
3093
3102
 
3094
3103
  const validators$1 = {};
3095
3104
 
@@ -3274,6 +3283,13 @@ class Axios {
3274
3283
  }
3275
3284
  }
3276
3285
 
3286
+ // Set config.allowAbsoluteUrls
3287
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
3288
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
3289
+ } else {
3290
+ config.allowAbsoluteUrls = true;
3291
+ }
3292
+
3277
3293
  validator.assertOptions(config, {
3278
3294
  baseUrl: validators.spelling('baseURL'),
3279
3295
  withXsrfToken: validators.spelling('withXSRFToken')
@@ -3369,7 +3385,7 @@ class Axios {
3369
3385
 
3370
3386
  getUri(config) {
3371
3387
  config = mergeConfig(this.defaults, config);
3372
- const fullPath = buildFullPath(config.baseURL, config.url);
3388
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3373
3389
  return buildURL(fullPath, config.params, config.paramsSerializer);
3374
3390
  }
3375
3391
  }