<p dir="auto">If a header has been set as a default, there does not appear to be any way to skip it on an individual request. Setting <code class="notranslate">null</code> or <code class="notranslate">undefined</code> doesn't do anything.</p>
<p dir="auto"><strong>Describe the issue</strong><br>
I have a component that initiates multiple requests to an API. If the user makes any subsequent requests to the same API before the server replies, previous calls are canceled. This works as expected. However, once a request gets canceled, an error is thrown, and axios doesn't correctly detect it is a cancel error (via <code class="notranslate">axios.isCancel(error)</code>)</p>
<p dir="auto">EXAMPLE:</p>
<ol dir="auto">
<li>Make API request, <code class="notranslate">requestA</code>, to '/api/does-stuff'</li>
<li>Before there is a response from <code class="notranslate">requestA</code>, make another API request, <code class="notranslate">requestB</code>, to '/api/does-stuff'</li>
<li><code class="notranslate">requestA</code> gets canceled and throws an error</li>
<li>When handling the error, check if it is an axios cancelation error (via <code class="notranslate">axios.isCancel(error)</code>)</li>
<li><code class="notranslate">axios.isCancel(error)</code> always returns false <g-emoji class="g-emoji" alias="sob" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f62d.png">😭</g-emoji></li>
</ol>
<p dir="auto"><strong>Example Code</strong><br>
Code snippet to illustrate your question</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Custom helper in my app to build a cancelable request
function buildCancelableRequest() {
  let call

  return requestOptions =&gt; {
    if (call) call.cancel()
    call = axios.CancelToken.source()

    return axios({ cancelToken: call.token, ...requestOptions })
      .then(() =&gt; {
        console.log('success')
      })
      .catch(error =&gt; {
        console.log(axios.isCancel(error)) // This is always false, even when the request cancels
      })
  }
}

...

// Usage
const myService = buildCancelableRequest()
myService({
  method: 'get',
  url: '/api/my-custom-api'
})"><pre class="notranslate"><span class="pl-c">// Custom helper in my app to build a cancelable request</span>
<span class="pl-k">function</span> <span class="pl-en">buildCancelableRequest</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> <span class="pl-s1">call</span>

  <span class="pl-k">return</span> <span class="pl-s1">requestOptions</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-s1">call</span><span class="pl-kos">)</span> <span class="pl-s1">call</span><span class="pl-kos">.</span><span class="pl-en">cancel</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-s1">call</span> <span class="pl-c1">=</span> <span class="pl-s1">axios</span><span class="pl-kos">.</span><span class="pl-c1">CancelToken</span><span class="pl-kos">.</span><span class="pl-en">source</span><span class="pl-kos">(</span><span class="pl-kos">)</span>

    <span class="pl-k">return</span> <span class="pl-en">axios</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">cancelToken</span>: <span class="pl-s1">call</span><span class="pl-kos">.</span><span class="pl-c1">token</span><span class="pl-kos">,</span> ...<span class="pl-s1">requestOptions</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-kos">)</span> <span class="pl-c1">=&gt;</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-s">'success'</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">error</span> <span class="pl-c1">=&gt;</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">axios</span><span class="pl-kos">.</span><span class="pl-en">isCancel</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-c">// This is always false, even when the request cancels</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-c">// Usage</span>
<span class="pl-c1">const</span> <span class="pl-s1">myService</span> <span class="pl-c1">=</span> <span class="pl-en">buildCancelableRequest</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-en">myService</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">method</span>: <span class="pl-s">'get'</span><span class="pl-kos">,</span>
  <span class="pl-c1">url</span>: <span class="pl-s">'/api/my-custom-api'</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<p dir="auto"><strong>Expected behavior, if applicable</strong><br>
axios.isCancel() should return true when the request cancels</p>
<p dir="auto"><strong>Environment:</strong></p>
<ul dir="auto">
<li>Axios Version: 0.19.2</li>
<li>Browser: Chrome</li>
<li>Browser Version: 79</li>
<li>Additional Library Versions: React 16.12.0</li>
</ul>