title: Chrome extension sending empty POST body
body: <p>I have created a Chrome extension that collects some data and sends a POST request to my server. The code sending this request is very simple:</p>
  <pre><code>var payload =
  {
      prop1: 'SomeValue',
      prop2: 'SomeValue',
      ...
  };
  var requestSettings = {
      method: 'POST',
      headers: {
          'Content-Type': ' application/json'
      },
      body: JSON.stringify(payload)
  };
  var webRequest = new Request(&quot;https://mysite.xyz/api/process&quot;, requestSettings);
  var response = await fetch(webRequest);
  </code></pre>
  <p>It works fine most of the times, but some of my users complained that the extension was not working properly, so I asked them to create a HAR file to see what was wrong with the requests that the extension was sending.</p>
  <p>After inspecting the <a href="https://pastebin.com/raw/tu1QtwAB" rel="nofollow noreferrer">HAR file</a> I found out that my extension was sending an empty POST body (<code>&quot;bodySize&quot;: 0</code> in HAR), although the <code>Content-Length</code> request header was not zero, and this caused my API to return an error, and the extension couldn't continue its work. Any ideas why the request body can be empty, and how to fix it?</p>