title: Test upload multiple files with FastApi
body: <p>I'm trying to test uploading a file to FastApi, but I keep getting 422 Validation Error.
  The file upload works in OpenApi interface, but not with the test below.</p>
  <p>The router:</p>
  <pre class="lang-py prettyprint-override"><code>@router.post(&quot;/files&quot;)
  def file_contents(files: List[UploadFile]):
      return someprocessing(files)
  </code></pre>
  <p>The test (using <code>TestClient</code> from FastApi):</p>
  <pre class="lang-py prettyprint-override"><code>response = client.post(
      url=&quot;/files&quot;,
      files={&quot;files&quot;: (&quot;file.xlsx&quot;, open(&quot;./test_files/file.xlsx&quot;, &quot;rb&quot;))},
      headers={**auth_headers, **{&quot;Content-Type&quot;: &quot;multipart/form-data&quot;}},
  )
  </code></pre>
  <p>The error:</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;detail&quot;:[{&quot;loc&quot;:[&quot;body&quot;],&quot;msg&quot;:&quot;value is not a valid dict&quot;,&quot;type&quot;:&quot;type_error.dict&quot;}]}
  </code></pre>
  <p>Update:
  All good I was sending files to a different url...</p>