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,7 @@
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
+ const crypto = require('crypto');
4
5
  const FormData$1 = require('form-data');
5
6
  const url = require('url');
6
7
  const proxyFromEnv = require('proxy-from-env');
@@ -14,6 +15,7 @@ const events = require('events');
14
15
 
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
17
 
18
+ const crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
17
19
  const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
18
20
  const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
19
21
  const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
@@ -643,8 +645,10 @@ const ALPHABET = {
643
645
  const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
644
646
  let str = '';
645
647
  const {length} = alphabet;
646
- while (size--) {
647
- str += alphabet[Math.random() * length|0];
648
+ const randomValues = new Uint32Array(size);
649
+ crypto__default["default"].randomFillSync(randomValues);
650
+ for (let i = 0; i < size; i++) {
651
+ str += alphabet[randomValues[i] % length];
648
652
  }
649
653
 
650
654
  return str;
@@ -2071,14 +2075,15 @@ function combineURLs(baseURL, relativeURL) {
2071
2075
  *
2072
2076
  * @returns {string} The combined full path
2073
2077
  */
2074
- function buildFullPath(baseURL, requestedURL) {
2075
- if (baseURL && !isAbsoluteURL(requestedURL)) {
2078
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2079
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
2080
+ if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
2076
2081
  return combineURLs(baseURL, requestedURL);
2077
2082
  }
2078
2083
  return requestedURL;
2079
2084
  }
2080
2085
 
2081
- const VERSION = "1.7.9";
2086
+ const VERSION = "1.8.0";
2082
2087
 
2083
2088
  function parseProtocol(url) {
2084
2089
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -4304,6 +4309,13 @@ class Axios {
4304
4309
  }
4305
4310
  }
4306
4311
 
4312
+ // Set config.allowAbsoluteUrls
4313
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
4314
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4315
+ } else {
4316
+ config.allowAbsoluteUrls = true;
4317
+ }
4318
+
4307
4319
  validator.assertOptions(config, {
4308
4320
  baseUrl: validators.spelling('baseURL'),
4309
4321
  withXsrfToken: validators.spelling('withXSRFToken')
@@ -4399,7 +4411,7 @@ class Axios {
4399
4411
 
4400
4412
  getUri(config) {
4401
4413
  config = mergeConfig(this.defaults, config);
4402
- const fullPath = buildFullPath(config.baseURL, config.url);
4414
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4403
4415
  return buildURL(fullPath, config.params, config.paramsSerializer);
4404
4416
  }
4405
4417
  }