title: form-data | axios: Unable to get headers from FormData, Error: getHeaders is not a function
body: <p>I am trying to post text and file fields using <code>form-data</code> and <code>axios</code>, but I am getting an error: <code>getHeaders()</code> is not a function. Below is my <code>submit</code> code, note that I am using <code>React</code> with <code>Typescript</code>.</p>
  
  <pre><code>import * as FormData from 'form-data'
  import axios from 'axios'
  
  submit(event: React.FormEvent&lt;HTMLFormElement&gt;) {
    event.preventDefault()
  
    const { title, description, pictureFile } = this.state
  
    let data = new FormData()
    data.append('title', title)
    data.append('description', description)
    data.append('picture', pictureFile)
  
    axios.post('/api/route', data, {
      headers: data.getHeaders() // ERROR: getHeaders is not a function
    })
      .then(res =&gt; handle(res))
      .catch(err =&gt; handle(err))
  }
  </code></pre>
  
  <p>The particular header I am interested in is the <code>Authorization</code>, I can set it manually, but then the boundaries are required so ... I better try to get that <code>getHeaders()</code> function to work.</p>
  
  <p>I don't get the problem here, <code>getHeaders</code> seems to be part of <code>form-data</code> API.</p>
  
  <p>Please help.</p>