title: Axios post request from react results in empty or weird body
body: <p>Working on my first MERN stack application. I'm trying to make an axios post request from my React client (port <strong>3000</strong>) to my MongoDB API (port <strong>3001</strong>). My post request code is: </p>
  
  <pre><code>&lt;button
          onClick={() =&gt; {
            axios({
              method: "post",
              url:
                "http://localhost:3000/api/update/documentID",
              data: { newNumber: 12345 },
              headers: { "Content-Type": "application/x-www-form-urlencoded" }
            });
          }}
        &gt;
          Click to run axios post request
  &lt;/button&gt;
  </code></pre>
  
  <p>This results in a body showing up on my port 3001 server as:</p>
  
  <pre><code>body: { '{"newNumber":12345}': '' }
  </code></pre>
  
  <p>I have my React proxy server set up and body-parser installed on my port 3001 server. I'm able to make the exact request I want using Postman. I can also get exactly what I want by replacing my Button in React with a Form, but obviously having to submit a form to make a post request isn't ideal. </p>
  
  <p>(Also, if I try to use axios.post(etc) instead of <code>axios({ method: post, etc.)</code>, I end up with an entirely empty body.</p>
  
  <p>Any help would be appreciated.</p>