<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/axios/axios/blob/16b5718954d88fbefe17f0b91101d742b63209c7/lib/core/mergeConfig.js#L19">axios/lib/core/mergeConfig.js</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 19
      in
      <a data-pjax="true" class="commit-tease-sha" href="/axios/axios/commit/16b5718954d88fbefe17f0b91101d742b63209c7">16b5718</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L19" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="19"></td>
          <td id="LC19" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">var</span> <span class="pl-s1">mergeDeepPropertiesKeys</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-s">'headers'</span><span class="pl-kos">,</span> <span class="pl-s">'auth'</span><span class="pl-kos">,</span> <span class="pl-s">'proxy'</span><span class="pl-kos">,</span> <span class="pl-s">'params'</span><span class="pl-kos">]</span><span class="pl-kos">;</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">keys in mergeDeepPropertiesKeys will be merged by utils.deepMerge but utils.deepMerge can only merge objects. Array type field will be converted like {‘0’: 'a', '1': 'b'}, no longer an array.</p>
<h3 dir="auto">Describe the issue</h3>
<p dir="auto">When I read the 'Axios' source code, I found that' utils. deepMerge() 'will convert arrays to objects, which is unreasonable.<br>
<a href="https://github.com/axios/axios/blob/master/lib/utils.js#L286">https://github.com/axios/axios/blob/master/lib/utils.js#L286</a></p>
<h3 dir="auto">Code</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var deepMerge = require('./lib/utils').deepMerge;
var a = {foo: {bar: 111}, hnd: [444, 555, 666]};
var b = {foo: {baz: 456}, hnd: [456, 789]};
console.log(deepMerge(a, b));"><pre class="notranslate"><code class="notranslate">var deepMerge = require('./lib/utils').deepMerge;
var a = {foo: {bar: 111}, hnd: [444, 555, 666]};
var b = {foo: {baz: 456}, hnd: [456, 789]};
console.log(deepMerge(a, b));
</code></pre></div>
<h3 dir="auto">result</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{ foo: { bar: 111, baz: 456 }, hnd: { '0': 456, '1': 789, '2': 666 } }"><pre class="notranslate"><code class="notranslate">{ foo: { bar: 111, baz: 456 }, hnd: { '0': 456, '1': 789, '2': 666 } }
</code></pre></div>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Executing 'utils.deepMerge()' does not change the data type.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{ foo: { bar: 111, baz: 456 }, hnd: [ 456, 789, 666 ] }"><pre class="notranslate"><code class="notranslate">{ foo: { bar: 111, baz: 456 }, hnd: [ 456, 789, 666 ] }
</code></pre></div>
<h3 dir="auto">Environment:</h3>
<p dir="auto">Axios Version 0.19.0</p>