- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Labels
Description
Actual Behavior
When it shout check response where request data was chunked it fails.
@property
def body(self) -> Optional[str]:
if self.request.body is None:
return None
if isinstance(self.request.body, bytes):
return self.request.body.decode("utf-8")
> assert isinstance(self.request.body, str)
E AssertionError
Expected Behavior
Check everithing which can, ideally chunked body itself.
Steps to Reproduce
@staticmethod
def chunk_generator(data):
for block in raw:
yield block
request = Request(method, url, headers=headers, data=chunk_generator(data), **kwargs)
response = session.send(session.prepare_request(request))
openapi_request = RequestsOpenAPIRequest(request)
openapi_response = RequestsOpenAPIResponse(response)
unmarshal_response(openapi_request, openapi_response, self.spec)
OpenAPI Core Version
0.17.1
OpenAPI Core Integration
requests
Affected Area(s)
unmarshaling
References
No response
Anything else we need to know?
No response
Would you like to implement a fix?
None
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
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
Request
object and pass onlyPreparedRequest
to request factory we will not be able to recreate generator and the original generator will be expired in theRequest
object.