2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

feat(fetch): add fetch, Request, Response env config variables for the adapter; (#7003)

* feat(fetch): add fetch, Request, Response env config variables for the adapter;

* feat(fetch): fixed design issue for environments without fetch API globals;
This commit is contained in:
Dmitriy Mozgovoy
2025-08-30 22:02:24 +03:00
committed by GitHub
parent a9f47afbf3
commit c959ff2901
7 changed files with 340 additions and 192 deletions
+5 -3
View File
@@ -148,7 +148,7 @@ const isEmptyObject = (val) => {
if (!isObject(val) || isBuffer(val)) {
return false;
}
try {
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
} catch (e) {
@@ -341,7 +341,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
* @returns {Object} Result of all merge properties
*/
function merge(/* obj1, obj2, obj3, ... */) {
const {caseless} = isContextDefined(this) && this || {};
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
const result = {};
const assignValue = (val, key) => {
const targetKey = caseless && findKey(result, key) || key;
@@ -352,7 +352,9 @@ function merge(/* obj1, obj2, obj3, ... */) {
} else if (isArray(val)) {
result[targetKey] = val.slice();
} else {
result[targetKey] = val;
if (!skipUndefined || !isUndefined(val)) {
result[targetKey] = val;
}
}
}