title: FastApi Post Request With Bytes Object Got 422 Error
body: <p>I am writing a python post request with a bytes body:</p>
  <pre><code>with open('srt_file.srt', 'rb') as f:
      data = f.read()
  
      res = requests.post(url='http://localhost:8000/api/parse/srt',
                          data=data,
                          headers={'Content-Type': 'application/octet-stream'})
  </code></pre>
  <p>And in the server part, I tried to parse the body:</p>
  <pre><code>app = FastAPI()
  BaseConfig.arbitrary_types_allowed = True
  
  
  class Data(BaseModel):
      data: bytes
  
  @app.post(&quot;/api/parse/{format}&quot;, response_model=CaptionJson)
  async def parse_input(format: str, data: Data) -&gt; CaptionJson:
      ...
  </code></pre>
  <p>However, I got the 422 error:
  <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></p>
  <p>So where is wrong with my code, and how should I fix it?
  Thank you all in advance for helping out!!</p>