python-openapi/openapi-core

Confusion with the Request.body type

p1c2u opened this issue · 0 comments

p1c2u commented

Discussed in #824

Originally posted by berislavlopac April 6, 2024
On this line:

def body(self) -> Optional[bytes]: ...

the type of the BaseRequest.body property is defined as Optional[bytes]; however, the docstring of the Request protocol (which inherits body from BaseRequest) says:

    body
       The request body, as string.

I'm currently having some issue with the validation, but it's not clear which direction should I go with the solution -- should body be bytes or str? Have I missed something? Thank you!