<p dir="auto"><strong>Describe the bug</strong><br>
The HTTP adapter does not use caseless comparison before overriding the <code class="notranslate">User-Agent</code> header or deleting the <code class="notranslate">Authorization</code> header.</p>
<p dir="auto">It also overwrites any provided <code class="notranslate">Content-Length</code> header.</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="axios({
  method: 'post',
  url: 'https://postman-echo.com/post',
  auth: {
    username: 'janedoe',
    password: 's00pers3cret'
  },
  headers: {
    authorization: 'foo',
    'Content-Length': 10,
    'User-agent': 'bar'
  },
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  }
})  
.then(function (response) {
  console.log(response.data);
})
.catch(function (error) {
  console.log(error);
});


&gt; { args: {},
  data: { firstName: 'Fred', lastName: 'Flintstone' },
  files: {},
  form: {},
  headers:
   { 'x-forwarded-proto': 'https',
     host: 'postman-echo.com',
     'content-length': '44',
     accept: 'application/json, text/plain, */*',
     authorization: 'foo',
     'content-type': 'application/json;charset=utf-8',
     'user-agent': 'axios/0.18.1',
     'x-forwarded-port': '443' },
  json: { firstName: 'Fred', lastName: 'Flintstone' },
  url: 'https://postman-echo.com/post' }"><pre class="notranslate"><span class="pl-en">axios</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">method</span>: <span class="pl-s">'post'</span><span class="pl-kos">,</span>
  <span class="pl-c1">url</span>: <span class="pl-s">'https://postman-echo.com/post'</span><span class="pl-kos">,</span>
  <span class="pl-c1">auth</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">username</span>: <span class="pl-s">'janedoe'</span><span class="pl-kos">,</span>
    <span class="pl-c1">password</span>: <span class="pl-s">'s00pers3cret'</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">headers</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">authorization</span>: <span class="pl-s">'foo'</span><span class="pl-kos">,</span>
    <span class="pl-s">'Content-Length'</span>: <span class="pl-c1">10</span><span class="pl-kos">,</span>
    <span class="pl-s">'User-agent'</span>: <span class="pl-s">'bar'</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">data</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">firstName</span>: <span class="pl-s">'Fred'</span><span class="pl-kos">,</span>
    <span class="pl-c1">lastName</span>: <span class="pl-s">'Flintstone'</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-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">response</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">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-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">catch</span><span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">error</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">error</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-c1">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">args</span>: <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">data</span>: <span class="pl-kos">{</span> <span class="pl-c1">firstName</span>: <span class="pl-s">'Fred'</span><span class="pl-kos">,</span> <span class="pl-c1">lastName</span>: <span class="pl-s">'Flintstone'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">files</span>: <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">form</span>: <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">headers</span>:
   <span class="pl-kos">{</span> <span class="pl-s">'x-forwarded-proto'</span>: <span class="pl-s">'https'</span><span class="pl-kos">,</span>
     <span class="pl-c1">host</span>: <span class="pl-s">'postman-echo.com'</span><span class="pl-kos">,</span>
     <span class="pl-s">'content-length'</span>: <span class="pl-s">'44'</span><span class="pl-kos">,</span>
     <span class="pl-c1">accept</span>: <span class="pl-s">'application/json, text/plain, */*'</span><span class="pl-kos">,</span>
     <span class="pl-c1">authorization</span>: <span class="pl-s">'foo'</span><span class="pl-kos">,</span>
     <span class="pl-s">'content-type'</span>: <span class="pl-s">'application/json;charset=utf-8'</span><span class="pl-kos">,</span>
     <span class="pl-s">'user-agent'</span>: <span class="pl-s">'axios/0.18.1'</span><span class="pl-kos">,</span>
     <span class="pl-s">'x-forwarded-port'</span>: <span class="pl-s">'443'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">json</span>: <span class="pl-kos">{</span> <span class="pl-c1">firstName</span>: <span class="pl-s">'Fred'</span><span class="pl-kos">,</span> <span class="pl-c1">lastName</span>: <span class="pl-s">'Flintstone'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">url</span>: <span class="pl-s">'https://postman-echo.com/post'</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior</strong><br>
The server should have received the following headers</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="     'x-forwarded-proto': 'https',
     host: 'postman-echo.com',
     'content-length': '10', // not '44'
     accept: 'application/json, text/plain, */*',
     authorization: 'Basic amFuZWRvZTpzMDBwZXJzM2NyZXQ=', // not 'foo'
     'content-type': 'application/json;charset=utf-8',
     'user-agent': 'bar', // not 'axios/0.18.1'
     'x-forwarded-port': '443'"><pre class="notranslate">     <span class="pl-s">'x-forwarded-proto'</span>: <span class="pl-s">'https'</span><span class="pl-kos">,</span>
     <span class="pl-s1">host</span>: <span class="pl-s">'postman-echo.com'</span><span class="pl-kos">,</span>
     <span class="pl-s">'content-length'</span>: <span class="pl-s">'10'</span><span class="pl-kos">,</span> <span class="pl-c">// not '44'</span>
     <span class="pl-s1">accept</span>: <span class="pl-s">'application/json, text/plain, */*'</span><span class="pl-kos">,</span>
     <span class="pl-s1">authorization</span>: <span class="pl-s">'Basic amFuZWRvZTpzMDBwZXJzM2NyZXQ='</span><span class="pl-kos">,</span> <span class="pl-c">// not 'foo'</span>
     <span class="pl-s">'content-type'</span>: <span class="pl-s">'application/json;charset=utf-8'</span><span class="pl-kos">,</span>
     <span class="pl-s">'user-agent'</span>: <span class="pl-s">'bar'</span><span class="pl-kos">,</span> <span class="pl-c">// not 'axios/0.18.1'</span>
     <span class="pl-s">'x-forwarded-port'</span>: <span class="pl-s">'443'</span></pre></div>
<p dir="auto">I have a PR ready, but saw you prefer an issue be created first.</p>
<p dir="auto"><strong>Summary</strong></p>
<p dir="auto">Headers provided in config are merged with defaults without checking for existing value that can be in different case</p>
<p dir="auto">i.e. when doing below request we can't predict which value will be set from defaults <code class="notranslate">Accept</code> or from config <code class="notranslate">accept</code></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="axios.request(url, {
  headers: {
    accept: 'some-accept-value'
  }
});"><pre class="notranslate"><span class="pl-s1">axios</span><span class="pl-kos">.</span><span class="pl-en">request</span><span class="pl-kos">(</span><span class="pl-s1">url</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
  <span class="pl-c1">headers</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">accept</span>: <span class="pl-s">'some-accept-value'</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Chrome will set <code class="notranslate">Accept</code>, which is not expected</p>
<p dir="auto"><strong>Context</strong></p>
<ul dir="auto">
<li>axios version: 0.17.0</li>
<li>Environment: node v9.2.1, chrome 63, macOS</li>
</ul>