1- /*! Axios v1.10 .0 Copyright (c) 2025 Matt Zabriskie and contributors */
1+ /*! Axios v1.11 .0 Copyright (c) 2025 Matt Zabriskie and contributors */
22'use strict' ;
33
44function bind ( fn , thisArg ) {
@@ -141,6 +141,27 @@ const isPlainObject = (val) => {
141141 return ( prototype === null || prototype === Object . prototype || Object . getPrototypeOf ( prototype ) === null ) && ! ( toStringTag in val ) && ! ( iterator in val ) ;
142142} ;
143143
144+ /**
145+ * Determine if a value is an empty object (safely handles Buffers)
146+ *
147+ * @param {* } val The value to test
148+ *
149+ * @returns {boolean } True if value is an empty object, otherwise false
150+ */
151+ const isEmptyObject = ( val ) => {
152+ // Early return for non-objects or Buffers to prevent RangeError
153+ if ( ! isObject ( val ) || isBuffer ( val ) ) {
154+ return false ;
155+ }
156+
157+ try {
158+ return Object . keys ( val ) . length === 0 && Object . getPrototypeOf ( val ) === Object . prototype ;
159+ } catch ( e ) {
160+ // Fallback for any other objects that might cause RangeError with Object.keys()
161+ return false ;
162+ }
163+ } ;
164+
144165/**
145166 * Determine if a value is a Date
146167 *
@@ -263,6 +284,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
263284 fn . call ( null , obj [ i ] , i , obj ) ;
264285 }
265286 } else {
287+ // Buffer check
288+ if ( isBuffer ( obj ) ) {
289+ return ;
290+ }
291+
266292 // Iterate over object keys
267293 const keys = allOwnKeys ? Object . getOwnPropertyNames ( obj ) : Object . keys ( obj ) ;
268294 const len = keys . length ;
@@ -276,6 +302,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
276302}
277303
278304function findKey ( obj , key ) {
305+ if ( isBuffer ( obj ) ) {
306+ return null ;
307+ }
308+
279309 key = key . toLowerCase ( ) ;
280310 const keys = Object . keys ( obj ) ;
281311 let i = keys . length ;
@@ -629,6 +659,11 @@ const toJSONObject = (obj) => {
629659 return ;
630660 }
631661
662+ //Buffer check
663+ if ( isBuffer ( source ) ) {
664+ return source ;
665+ }
666+
632667 if ( ! ( 'toJSON' in source ) ) {
633668 stack [ i ] = source ;
634669 const target = isArray ( source ) ? [ ] : { } ;
@@ -700,6 +735,7 @@ var utils$1 = {
700735 isBoolean,
701736 isObject,
702737 isPlainObject,
738+ isEmptyObject,
703739 isReadableStream,
704740 isRequest,
705741 isResponse,
@@ -1331,16 +1367,17 @@ var platform = {
13311367} ;
13321368
13331369function toURLEncodedForm ( data , options ) {
1334- return toFormData ( data , new platform . classes . URLSearchParams ( ) , Object . assign ( {
1370+ return toFormData ( data , new platform . classes . URLSearchParams ( ) , {
13351371 visitor : function ( value , key , path , helpers ) {
13361372 if ( platform . isNode && utils$1 . isBuffer ( value ) ) {
13371373 this . append ( key , value . toString ( 'base64' ) ) ;
13381374 return false ;
13391375 }
13401376
13411377 return helpers . defaultVisitor . apply ( this , arguments ) ;
1342- }
1343- } , options ) ) ;
1378+ } ,
1379+ ...options
1380+ } ) ;
13441381}
13451382
13461383/**
@@ -2093,7 +2130,7 @@ function throttle(fn, freq) {
20932130 clearTimeout ( timer ) ;
20942131 timer = null ;
20952132 }
2096- fn . apply ( null , args ) ;
2133+ fn ( ... args ) ;
20972134 } ;
20982135
20992136 const throttled = ( ...args ) => {
@@ -2349,7 +2386,7 @@ function mergeConfig(config1, config2) {
23492386 headers : ( a , b , prop ) => mergeDeepProperties ( headersToObject ( a ) , headersToObject ( b ) , prop , true )
23502387 } ;
23512388
2352- utils$1 . forEach ( Object . keys ( Object . assign ( { } , config1 , config2 ) ) , function computeConfigValue ( prop ) {
2389+ utils$1 . forEach ( Object . keys ( { ... config1 , ... config2 } ) , function computeConfigValue ( prop ) {
23532390 const merge = mergeMap [ prop ] || mergeDeepProperties ;
23542391 const configValue = merge ( config1 [ prop ] , config2 [ prop ] , prop ) ;
23552392 ( utils$1 . isUndefined ( configValue ) && merge !== mergeDirectKeys ) || ( config [ prop ] = configValue ) ;
@@ -3090,7 +3127,7 @@ function dispatchRequest(config) {
30903127 } ) ;
30913128}
30923129
3093- const VERSION = "1.10 .0" ;
3130+ const VERSION = "1.11 .0" ;
30943131
30953132const validators$1 = { } ;
30963133
@@ -3329,8 +3366,8 @@ class Axios {
33293366
33303367 if ( ! synchronousRequestInterceptors ) {
33313368 const chain = [ dispatchRequest . bind ( this ) , undefined ] ;
3332- chain . unshift . apply ( chain , requestInterceptorChain ) ;
3333- chain . push . apply ( chain , responseInterceptorChain ) ;
3369+ chain . unshift ( ... requestInterceptorChain ) ;
3370+ chain . push ( ... responseInterceptorChain ) ;
33343371 len = chain . length ;
33353372
33363373 promise = Promise . resolve ( config ) ;
0 commit comments