title: How to get the Content-Length header from a POST request send with axios?
body: <p>I want to use the size and data of my POST request. I was doing some research and found out about the Content-Length header of a request, but I can't find it in my axios request headers.</p>
  
  <p>I tried using interceptors, like that :</p>
  
  <pre><code>axios.interceptors.request.use(
      config =&gt; {
          console.log('config', config.headers);
          if (config.url != `${API_URL}/login`)
              config.headers.Authorization = 'Bearer ' + getAccessToken();
          return config;
      },
  
      error =&gt; {
          return Promise.reject(error);
      }
  );
  </code></pre>
  
  <p>And here is the response that I get:</p>
  
  <pre><code>Authorization: "Bearer [...access_token]"
  Content-Type: "multipart/form-data"
  common:
      Accept: "application/json, text/plain, */*"
      X-CSRF-TOKEN: "..."
      X-Requested-With: "XMLHttpRequest"
      __proto__: Object
  delete: {}
  get: {}
  head: {}
  patch: {Content-Type: "application/x-www-form-urlencoded"}
  post: {Content-Type: "application/x-www-form-urlencoded"}
  put: {Content-Type: "application/x-www-form-urlencoded"}
  </code></pre>
  
  <p>But in in Chrome this is what is shown:</p>
  
  <pre><code>Accept: application/json, text/plain
  Accept-Encoding: gzip, deflate
  Accept-Language: en-US,en;q=0.9,ro;q=0.8,la;q=0.7
  Authorization: Bearer [...access_token]
  Connection: keep-alive
  
  Content-Length: 5266672 &lt;---- this is what I need
  
  Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryGMzak87LIZH05nme
  Cookie: XSRF-TOKEN= ...
  Host: ...
  Origin: ...
  Referer: ...
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
  X-CSRF-TOKEN: ...
  X-Requested-With: XMLHttpRequest
  X-XSRF-TOKEN: ...
  </code></pre>
  
  <p>Is there any way to make axios give me the content-length header? If not, is there any way to access it from anywhere else?</p>