<p dir="auto">Hello everyone,</p>
<p dir="auto">first things first – thanks to all of you for devoting your valuable time to this project! I have not found a corresponding issue for this case and I am not sure whether it is a bug or a feature. If it is a feature, please read this post as a suggestion for a more explicit documentation of the behavior.</p>
<p dir="auto"><strong>Describe the bug</strong><br>
When I specify some request (or response) transformations in the default config and then use an empty array (or one with less transformation functions than the default has) in a request's transformation config, some of the default transformations are still being applied.</p>
<p dir="auto"><strong>To Reproduce</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="client = Axios.create({
  transformRequest: [
    deepKebabTransform,
    JSON.stringify
  ]
})

// ...

// a) 
client.put(url, data, { transformRequest: [] })

// b)
client.put(url, data, { transformRequest: [data =&gt; data] })"><pre class="notranslate"><span class="pl-s1">client</span> <span class="pl-c1">=</span> <span class="pl-v">Axios</span><span class="pl-kos">.</span><span class="pl-en">create</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">transformRequest</span>: <span class="pl-kos">[</span>
    <span class="pl-s1">deepKebabTransform</span><span class="pl-kos">,</span>
    <span class="pl-c1">JSON</span><span class="pl-kos">.</span><span class="pl-c1">stringify</span>
  <span class="pl-kos">]</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-c">// ...</span>

<span class="pl-c">// a) </span>
<span class="pl-s1">client</span><span class="pl-kos">.</span><span class="pl-en">put</span><span class="pl-kos">(</span><span class="pl-s1">url</span><span class="pl-kos">,</span> <span class="pl-s1">data</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">transformRequest</span>: <span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-c">// b)</span>
<span class="pl-s1">client</span><span class="pl-kos">.</span><span class="pl-en">put</span><span class="pl-kos">(</span><span class="pl-s1">url</span><span class="pl-kos">,</span> <span class="pl-s1">data</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">transformRequest</span>: <span class="pl-kos">[</span><span class="pl-s1">data</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">data</span><span class="pl-kos">]</span> <span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">In both cases, <code class="notranslate">JSON.stringify</code> is still run. In case a), both functions from the default config are applied.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
I would expect the default config entries for <code class="notranslate">transformRequest</code> and <code class="notranslate">transformResponse</code> (if not all array entries) to be either replaced completely by or merged with their counterparts in a request's config.</p>
<p dir="auto"><strong>Environment:</strong></p>
<ul dir="auto">
<li>Axios Version 0.18.0</li>
<li>OS: OSX 10.15.2</li>
<li>Browser: tested in Chrome 79.0.3945.88, Safari 13.0.4</li>
</ul>
<p dir="auto"><strong>Additional context</strong><br>
Regarding the <code class="notranslate">merge</code> function in <code class="notranslate">utils</code> I came to the assumption, that the arrays would likely be treated as objects and thus their entries are effectively overridden positionally.</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>