title: Python FastApi error 422 (Unprocessable Entity)
body: <p>When I use a POST request to send form data from a JS script running on port 5500 using XMLHttpRequest to my backend which is a FastAPI app running on port 8000, I am always met with this error <code>Unprocessable Entity</code>.
  Here is the server-side:</p>
  <pre><code>origins = [&quot;https://localhost:5500&quot;]
  app.add_middleware(
      CORSMiddleware,
      allow_origins=origins,
      allow_credentials=True,
      allow_methods=[&quot;*&quot;],
      allow_headers=[&quot;*&quot;],
  )
  
  
  @app.post(&quot;/test&quot;)
  def test(username: str = Form(...)):
      print(f&quot;########### Received {username} #############&quot;)
  </code></pre>
  <p>And here is the client-side code:</p>
  <pre><code>async function sendData() {
      formData = new FormData();
      formData.append('username', 'Kareem');
      const response = await fetch('http://localhost:8000/test', {
          method: 'POST',
          data: formData
      })
  }
  </code></pre>