You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import types
class RequestsOpenAPIRequestFix(RequestsOpenAPIRequest):
...
@property
def body(self) -> Optional[str]:
if self.request.body is None or isinstance(self.request.body, types.GeneratorType):
return None
if isinstance(self.request.body, bytes):
return self.request.body.decode("utf-8")
assert isinstance(self.request.body, str)
# TODO: figure out if request._body_position is relevant
return self.request.body
It can be done with Request object but if user has Request object and pass only PreparedRequest to request factory we will not be able to recreate generator and the original generator will be expired in the Request object.
Activity
jitka commentedon Apr 11, 2023
possible fix
p1c2u commentedon Apr 13, 2023
Generator should be resolved to string and passed further to the request if we want to validate the body.
p1c2u commentedon Apr 13, 2023
It can be done with Request object but if user has
Requestobject and pass onlyPreparedRequestto request factory we will not be able to recreate generator and the original generator will be expired in theRequestobject.