How can I set custom headers when sending FormData with fetch?
<p>I'm trying to post a file using fetch API.</p>

<p>After having problems with getting errors with "Not boundary found" messages I discovered I was doing it wrong:</p>

<pre><code>getHeaders() {
  return new Headers({
    'Accept': 'application/json',
    'x-access-token': cookies.load('token'),
  });
}

const data = new FormData();
data.append('file', file);
return fetch(this.concatToUrl(url), {
  method: 'POST',
  headers: this.getHeaders(),
  body: data,
});
</code></pre>

<p>I was overwritting FormData boundary headers and content-length.</p>

<p>The problem is that a need to set those headers to allow JWT auth. How can I set them without loosing the Content-Lenght and Boundary properties?</p>

<p>Thanks</p>