@@ -4,7 +4,7 @@ var utils = require('../utils');
4
4
5
5
/**
6
6
* Config-specific merge-function which creates a new config-object
7
- * based on given defaults and instance config .
7
+ * by merging two configuration objects together .
8
8
*
9
9
* @param {Object } config1
10
10
* @param {Object } config2
@@ -15,13 +15,11 @@ module.exports = function mergeConfig(config1, config2) {
15
15
config2 = config2 || { } ;
16
16
var config = { } ;
17
17
18
- utils . forEach ( [ 'url' , 'method' , 'params' , 'data' ] , function valueFromInstanceConfig ( prop ) {
19
- if ( typeof config2 [ prop ] !== 'undefined' ) {
20
- config [ prop ] = config2 [ prop ] ;
21
- }
18
+ utils . forEach ( [ 'url' , 'method' , 'params' , 'data' ] , function valueFromConfig2 ( prop ) {
19
+ config [ prop ] = config2 [ prop ] ;
22
20
} ) ;
23
21
24
- utils . forEach ( [ 'headers' , 'auth' , 'proxy' ] , function mergeInstanceConfigWithDefaults ( prop ) {
22
+ utils . forEach ( [ 'headers' , 'auth' , 'proxy' ] , function mergeValues ( prop ) {
25
23
if ( typeof config2 [ prop ] !== 'undefined' ) {
26
24
if ( typeof config2 [ prop ] === 'object' ) {
27
25
config [ prop ] = utils . deepMerge ( config1 [ prop ] , config2 [ prop ] ) ;
@@ -38,7 +36,7 @@ module.exports = function mergeConfig(config1, config2) {
38
36
'timeout' , 'withCredentials' , 'adapter' , 'responseType' , 'xsrfCookieName' ,
39
37
'xsrfHeaderName' , 'onUploadProgress' , 'onDownloadProgress' , 'maxContentLength' ,
40
38
'validateStatus' , 'maxRedirects' , 'httpAgent' , 'httpsAgent' , 'cancelToken'
41
- ] , function defaultToInstanceConfig ( prop ) {
39
+ ] , function defaultToConfig2 ( prop ) {
42
40
config [ prop ] = typeof config2 [ prop ] === 'undefined' ? config1 [ prop ] : config2 [ prop ] ;
43
41
} ) ;
44
42
0 commit comments