<h4 dir="auto">Describe the bug</h4>
<p dir="auto">When making a request to the server that generates a non 2xx status code, in node the <code class="notranslate">response.data</code> field is populated with the returned error message, in the browser, the field is consistently null for all requests (so far only tested with 4xx status codes)</p>
<h4 dir="auto">To Reproduce</h4>
<p dir="auto">Using axios version 0.21.1</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function testSearch_error2(client: AxiosInstance) {
client.get(&quot;/api/archive/search&quot;, {params: {start: &quot;2020-01-25&quot;, long: -33.8523, lat: 151.2108}})
.then((resp) =&gt; {
    if (!Array.isArray(resp.data)) {
        return Promise.reject(&quot;response was not an array of results&quot;);
    }

    return resp.data as SearchResult[];
})
.catch(handleError);
}

function handleError(e: AxiosError): Promise&lt;never&gt; {
    if (!(e?.response?.data)) {
       console.dir(e);
    }
    return Promise.reject(e?.response?.data || e);
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">testSearch_error2</span><span class="pl-kos">(</span><span class="pl-s1">client</span>: <span class="pl-v">AxiosInstance</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
<span class="pl-s1">client</span><span class="pl-kos">.</span><span class="pl-en">get</span><span class="pl-kos">(</span><span class="pl-s">"/api/archive/search"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">params</span>: <span class="pl-kos">{</span><span class="pl-c1">start</span>: <span class="pl-s">"2020-01-25"</span><span class="pl-kos">,</span> <span class="pl-c1">long</span>: <span class="pl-c1">-</span><span class="pl-c1">33.8523</span><span class="pl-kos">,</span> <span class="pl-c1">lat</span>: <span class="pl-c1">151.2108</span><span class="pl-kos">}</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">resp</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-c1">!</span><span class="pl-v">Array</span><span class="pl-kos">.</span><span class="pl-en">isArray</span><span class="pl-kos">(</span><span class="pl-s1">resp</span><span class="pl-kos">.</span><span class="pl-c1">data</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-v">Promise</span><span class="pl-kos">.</span><span class="pl-en">reject</span><span class="pl-kos">(</span><span class="pl-s">"response was not an array of results"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>

    <span class="pl-k">return</span> <span class="pl-s1">resp</span><span class="pl-kos">.</span><span class="pl-c1">data</span> <span class="pl-s1">as</span> <span class="pl-v">SearchResult</span><span class="pl-kos">[</span><span class="pl-s1"></span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">catch</span><span class="pl-kos">(</span><span class="pl-s1">handleError</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">handleError</span><span class="pl-kos">(</span><span class="pl-s1">e</span>: <span class="pl-v">AxiosError</span><span class="pl-kos">)</span>: <span class="pl-v">Promise</span><span class="pl-c1">&lt;</span><span class="pl-s1">never</span><span class="pl-c1">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-c1">!</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">?.</span><span class="pl-c1">response</span><span class="pl-kos">?.</span><span class="pl-c1">data</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
       <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">dir</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-v">Promise</span><span class="pl-kos">.</span><span class="pl-en">reject</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">?.</span><span class="pl-c1">response</span><span class="pl-kos">?.</span><span class="pl-c1">data</span> <span class="pl-c1">||</span> <span class="pl-s1">e</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This searches a geospatial testing API, it will return a 401 error as the lat and long have been swapped and are out of range as a result.<br>
The server returns plain strings as the response to a 400 error explaining the issue</p>
<p dir="auto">Normally the result is passed out to the caller, and <code class="notranslate">handleError</code> ensures we pass out the specific error from the server, and falls back to the axios error if its something more complicated.</p>
<p dir="auto">As mentioned, this behaves as expected when run in node, but when the same code is bundled for the browser, it always returns the axios error.</p>
<p dir="auto">Using the <code class="notranslate">console.dir</code> call added while diagnosing this, I find that the <code class="notranslate">response</code> field is populated with the response details as I would expect. However, the <code class="notranslate">data</code> field is always null.<br>
Inspecting the request in the network tab of the browser (mostly chrome in testing) shows the response, and its body is present, so I know this isn't the server failing to send a body with the response.</p>
<h4 dir="auto">Expected behaviour</h4>
<p dir="auto">the <code class="notranslate">response.data</code> field to be populated with the body of the response</p>
<p dir="auto">given some <a href="https://stackoverflow.com/questions/45417837/react-native-axios-method-post-response-data-null?r=SearchResults&amp;s=1%7C89.3093" rel="nofollow">similar issues in react-native</a> on <a href="https://stackoverflow.com/questions/59190115/react-native-axios-method-get-response-data-shows-null?r=SearchResults&amp;s=2%7C65.1607" rel="nofollow">stack overflow</a> could this potentially be an inconsistency in the library when building for the browser v node?</p>
<h4 dir="auto">Environment</h4>
<ul dir="auto">
<li>Axios Version 0.21.1</li>
<li>Adapter XHR</li>
<li>Browser Chrome</li>
<li>Browser Version 87.0.4280.141</li>
<li>Node.js Version v10.16.0 (on an old laptop, this has reminded me to update</li>
<li>OS: Windows 10.0.19042 Build 19042</li>
<li>Additional Library Versions TypeScript 4.1.3, (webpack 5.15.0 and ts-loader 8.0.14 if relevant)</li>
</ul>
<h4 dir="auto">Additional context/Screenshots</h4>
<p dir="auto">Here you can see the <code class="notranslate">response.data</code> field being null<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14145969/105652830-60042f80-5f0e-11eb-96bb-819da7091a00.png"><img src="https://user-images.githubusercontent.com/14145969/105652830-60042f80-5f0e-11eb-96bb-819da7091a00.png" alt="2021-01-25 (3)" style="max-width: 100%;"></a></p>
<p dir="auto">The relevant network tab entry<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14145969/105652842-65fa1080-5f0e-11eb-9683-2ef6e1fb165d.png"><img src="https://user-images.githubusercontent.com/14145969/105652842-65fa1080-5f0e-11eb-9683-2ef6e1fb165d.png" alt="2021-01-25 (2)" style="max-width: 100%;"></a></p>
<p dir="auto">The network tabs response<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/14145969/105652846-698d9780-5f0e-11eb-8045-d411b624053d.png"><img src="https://user-images.githubusercontent.com/14145969/105652846-698d9780-5f0e-11eb-8045-d411b624053d.png" alt="2021-01-25 (1)" style="max-width: 100%;"></a></p>
<p dir="auto">Seems to be because the config created by create is not being merged correctly</p>
<h3 dir="auto">Describe the bug</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="F {message: 'options must be an object', name: 'AxiosError', code: 'ERR_BAD_OPTION_VALUE', stack: 'AxiosError: options must be an object\n    at Objec…le:///Users/chenkai/Desktop/test/index.html:21:28'}
code
: 
&quot;ERR_BAD_OPTION_VALUE&quot;
message
: 
&quot;options must be an object&quot;
name
: 
&quot;AxiosError&quot;
stack
: 
&quot;AxiosError: options must be an object\n    at Object.Je [as assertOptions] (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:3:10223)\n    at B.request (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:3:10983)\n    at B.&lt;computed&gt; [as get] (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:3:12121)\n    at Function.get (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:2:148)\n    at file:///Users/chenkai/Desktop/test/index.html:21:28&quot;
[[Prototype]]
: 
Error"><pre class="notranslate"><span class="pl-v">F</span> <span class="pl-kos">{</span><span class="pl-c1">message</span>: <span class="pl-s">'options must be an object'</span><span class="pl-kos">,</span> <span class="pl-c1">name</span>: <span class="pl-s">'AxiosError'</span><span class="pl-kos">,</span> <span class="pl-c1">code</span>: <span class="pl-s">'ERR_BAD_OPTION_VALUE'</span><span class="pl-kos">,</span> <span class="pl-c1">stack</span>: <span class="pl-s">'AxiosError: options must be an object\n    at Objec…le:///Users/chenkai/Desktop/test/index.html:21:28'</span><span class="pl-kos">}</span>
code
: 
<span class="pl-s">"ERR_BAD_OPTION_VALUE"</span>
message
: 
<span class="pl-s">"options must be an object"</span>
name
: 
<span class="pl-s">"AxiosError"</span>
stack
: 
<span class="pl-s">"AxiosError: options must be an object\n    at Object.Je [as assertOptions] (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:3:10223)\n    at B.request (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:3:10983)\n    at B.&lt;computed&gt; [as get] (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:3:12121)\n    at Function.get (https://esm.sh/v96/axios@1.1.3/es2022/axios.js:2:148)\n    at file:///Users/chenkai/Desktop/test/index.html:21:28"</span>
<span class="pl-kos">[</span><span class="pl-kos">[</span><span class="pl-v">Prototype</span><span class="pl-kos">]</span><span class="pl-kos">]</span>
: 
<span class="pl-v">Error</span></pre></div>
<h3 dir="auto">To Reproduce</h3>
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
  &lt;title&gt;Document&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;script type=&quot;module&quot;&gt;
import Axios from 'https://esm.sh/axios';
import Qs from 'https://esm.sh/qs@6.11.0';

const instance = Axios.create({
  paramsSerializer(params) {
    return Qs.stringify(params, {arrayFormat: 'brackets'})
  },
});

const res = await instance.get('https://jsonplaceholder.typicode.com/comments');
console.log(res);
&lt;/script&gt;
&lt;/html&gt;"><pre class="notranslate"><span class="pl-c1">&lt;!DOCTYPE html<span class="pl-kos">&gt;</span></span>
<span class="pl-kos">&lt;</span><span class="pl-ent">html</span> <span class="pl-c1">lang</span>="<span class="pl-s">en</span>"<span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">head</span><span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">meta</span> <span class="pl-c1">charset</span>="<span class="pl-s">UTF-8</span>"<span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">meta</span> <span class="pl-c1">http-equiv</span>="<span class="pl-s">X-UA-Compatible</span>" <span class="pl-c1">content</span>="<span class="pl-s">IE=edge</span>"<span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">meta</span> <span class="pl-c1">name</span>="<span class="pl-s">viewport</span>" <span class="pl-c1">content</span>="<span class="pl-s">width=device-width, initial-scale=1.0</span>"<span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">title</span><span class="pl-kos">&gt;</span>Document<span class="pl-kos">&lt;/</span><span class="pl-ent">title</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">head</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">body</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">body</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">type</span>="<span class="pl-s">module</span>"<span class="pl-kos">&gt;</span>
<span class="pl-k">import</span> <span class="pl-v">Axios</span> <span class="pl-k">from</span> <span class="pl-s">'https://esm.sh/axios'</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-v">Qs</span> <span class="pl-k">from</span> <span class="pl-s">'https://esm.sh/qs@6.11.0'</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">instance</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-en">paramsSerializer</span><span class="pl-kos">(</span><span class="pl-s1">params</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-v">Qs</span><span class="pl-kos">.</span><span class="pl-en">stringify</span><span class="pl-kos">(</span><span class="pl-s1">params</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">arrayFormat</span>: <span class="pl-s">'brackets'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">instance</span><span class="pl-kos">.</span><span class="pl-en">get</span><span class="pl-kos">(</span><span class="pl-s">'https://jsonplaceholder.typicode.com/comments'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">res</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">html</span><span class="pl-kos">&gt;</span></pre></div>
<h3 dir="auto">Code snippet</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Axios Version</h3>
<p dir="auto">v1.1.3</p>
<h3 dir="auto">Adapter Version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Browser</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Browser Version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Node.js Version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">OS</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional Library Versions</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context/Screenshots</h3>
<p dir="auto"><em>No response</em></p>