mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
chore(release): v1.11.0 (#6974)
Co-authored-by: jasonsaayman <4814473+jasonsaayman@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e72c193722
commit
b76c4ac6f8
Vendored
+46
-9
@@ -1,4 +1,4 @@
|
||||
/*! Axios v1.10.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
||||
/*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
||||
'use strict';
|
||||
|
||||
const FormData$1 = require('form-data');
|
||||
@@ -166,6 +166,27 @@ const isPlainObject = (val) => {
|
||||
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a value is an empty object (safely handles Buffers)
|
||||
*
|
||||
* @param {*} val The value to test
|
||||
*
|
||||
* @returns {boolean} True if value is an empty object, otherwise false
|
||||
*/
|
||||
const isEmptyObject = (val) => {
|
||||
// Early return for non-objects or Buffers to prevent RangeError
|
||||
if (!isObject(val) || isBuffer(val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
||||
} catch (e) {
|
||||
// Fallback for any other objects that might cause RangeError with Object.keys()
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a value is a Date
|
||||
*
|
||||
@@ -288,6 +309,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
fn.call(null, obj[i], i, obj);
|
||||
}
|
||||
} else {
|
||||
// Buffer check
|
||||
if (isBuffer(obj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate over object keys
|
||||
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
||||
const len = keys.length;
|
||||
@@ -301,6 +327,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
}
|
||||
|
||||
function findKey(obj, key) {
|
||||
if (isBuffer(obj)){
|
||||
return null;
|
||||
}
|
||||
|
||||
key = key.toLowerCase();
|
||||
const keys = Object.keys(obj);
|
||||
let i = keys.length;
|
||||
@@ -654,6 +684,11 @@ const toJSONObject = (obj) => {
|
||||
return;
|
||||
}
|
||||
|
||||
//Buffer check
|
||||
if (isBuffer(source)) {
|
||||
return source;
|
||||
}
|
||||
|
||||
if(!('toJSON' in source)) {
|
||||
stack[i] = source;
|
||||
const target = isArray(source) ? [] : {};
|
||||
@@ -725,6 +760,7 @@ const utils$1 = {
|
||||
isBoolean,
|
||||
isObject,
|
||||
isPlainObject,
|
||||
isEmptyObject,
|
||||
isReadableStream,
|
||||
isRequest,
|
||||
isResponse,
|
||||
@@ -1374,7 +1410,7 @@ const platform = {
|
||||
};
|
||||
|
||||
function toURLEncodedForm(data, options) {
|
||||
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
||||
return toFormData(data, new platform.classes.URLSearchParams(), {
|
||||
visitor: function(value, key, path, helpers) {
|
||||
if (platform.isNode && utils$1.isBuffer(value)) {
|
||||
this.append(key, value.toString('base64'));
|
||||
@@ -1382,8 +1418,9 @@ function toURLEncodedForm(data, options) {
|
||||
}
|
||||
|
||||
return helpers.defaultVisitor.apply(this, arguments);
|
||||
}
|
||||
}, options));
|
||||
},
|
||||
...options
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2106,7 +2143,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
||||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.10.0";
|
||||
const VERSION = "1.11.0";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
@@ -2534,7 +2571,7 @@ function throttle(fn, freq) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
fn.apply(null, args);
|
||||
fn(...args);
|
||||
};
|
||||
|
||||
const throttled = (...args) => {
|
||||
@@ -3408,7 +3445,7 @@ function mergeConfig(config1, config2) {
|
||||
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
||||
};
|
||||
|
||||
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
||||
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||
const configValue = merge(config1[prop], config2[prop], prop);
|
||||
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||
@@ -4386,8 +4423,8 @@ class Axios {
|
||||
|
||||
if (!synchronousRequestInterceptors) {
|
||||
const chain = [dispatchRequest.bind(this), undefined];
|
||||
chain.unshift.apply(chain, requestInterceptorChain);
|
||||
chain.push.apply(chain, responseInterceptorChain);
|
||||
chain.unshift(...requestInterceptorChain);
|
||||
chain.push(...responseInterceptorChain);
|
||||
len = chain.length;
|
||||
|
||||
promise = Promise.resolve(config);
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user