title: POST error with missing body when use XMLHttpRequest but works with Fetch?
body: <p>I have the following post function</p>
  <pre><code>var XMLHttpRequest = require(&quot;xmlhttprequest&quot;).XMLHttpRequest;
  function post(url, params, callback, method='POST') {
    var http = new XMLHttpRequest();
    http.open(method, url, true);
    http.setRequestHeader('Content-type', 'application/json');
    http.onload = function() {
      console.log(http.status) &lt;---- 500
      console.log(http.responseText) &lt;----'ERROR: An 'ipAddr' must be provided in the request body.',
      callback(http);
    };
    console.log(JSON.stringify(params)) &lt;--- print {&quot;ipAddr&quot;:&quot;175.00.00.00&quot;,&quot;params&quot;:&quot;params_string&quot;}
    http.send(JSON.stringify(params));
  }
  </code></pre>
  <p>keep getting 500 with responseText saying <code>ipAddr</code> is missing
  but I am passing in <code>ipAddr</code> in the request body...what am I missing?</p>
  <p>by the way the endpoint I am trying to reach works. Confrimed with curl</p>
  <pre><code>curl -i --header tion/json&quot; -d '{&quot;ipAddr&quot;: &quot;175.00.00.00&quot;, &quot;params&quot;: &quot;params_string&quot;}' --request POST https://my.endpoint/run
  </code></pre>
  <p>this returns me a 200 result.</p>
  <hr />
  <p><strong>update...</strong></p>
  <p>switch to using fetch, then it worked? not sure why, its the same content translate over</p>
  <pre><code>var fetch = require(&quot;node-fetch&quot;);
  function post(url, params, callback, method='POST') {
    // request options
    const options = {
      method: 'POST',
      body: JSON.stringify(params),
      headers: {
          'Content-Type': 'application/json',
      }
    }
  
    // send post request
    fetch(url, options)
      .then(res =&gt; res.json())
      .then(res =&gt; console.log(res))
      .catch(err =&gt; console.error(err));
    
  }
  </code></pre>