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:
+5
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user