title: Test with FastAPI TestClient returns 422 status code
body: <p>I try to test an endpoint with the <code>TestClient</code> from FastAPI (which is the Scarlett TestClient basically).</p>
  <p>The response code is always 422 Unprocessable Entity.</p>
  <p>This is my current Code:</p>
  <pre class="lang-py prettyprint-override"><code>from typing import Dict, Optional
  
  from fastapi import APIRouter
  from pydantic import BaseModel
  
  router = APIRouter()
  
  
  class CreateRequest(BaseModel):
      number: int
      ttl: Optional[float] = None
  
  
  @router.post(&quot;/create&quot;)
  async def create_users(body: CreateRequest) -&gt; Dict:
      return {
          &quot;msg&quot;: f&quot;{body.number} Users are created&quot;
      }
  </code></pre>
  <p>As you can see I'm also passing the <code>application/json</code> header to the client to avoid a potential error.</p>
  <p>And this is my Test:</p>
  <pre class="lang-py prettyprint-override"><code>from fastapi.testclient import TestClient
  from metusa import app
  
  
  def test_create_50_users():
      client = TestClient(app)
      client.headers[&quot;Content-Type&quot;] = &quot;application/json&quot;
  
      body = {
          &quot;number&quot;: 50,
          &quot;ttl&quot;: 2.0
      }
      response = client.post('/v1/users/create', data=body)
  
      assert response.status_code == 200
      assert response.json() == {&quot;msg&quot;: &quot;50 Users created&quot;}
  
  </code></pre>
  <p>I also found this error message in the Response Object</p>
  <pre><code>b'{&quot;detail&quot;:[{&quot;loc&quot;:[&quot;body&quot;,0],&quot;msg&quot;:&quot;Expecting value: line 1 column 1 (char 0)&quot;,&quot;type&quot;:&quot;value_error.jsondecode&quot;,&quot;ctx&quot;:{&quot;msg&quot;:&quot;Expecting value&quot;,&quot;doc&quot;:&quot;number=50&amp;ttl=2.0&quot;,&quot;pos&quot;:0,&quot;lineno&quot;:1,&quot;colno&quot;:1}}]}'
  </code></pre>
  <p>Thank you for your support and time!</p>