-
-
Notifications
You must be signed in to change notification settings - Fork 133
use prepared request to format payload before converting #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I ran into this same problem with 'json'. I have to prepare the request either way to send it, so it makes sense for the OpenAPI Request object to be created from that. |
I ran into problems trying to support requests with
edit: or does it hmmmm |
I was using this code successfully, but it stopped working after updated Edit: I had to add a deserializer: openapi_request_validator = RequestValidator(
openapi_spec,
custom_media_type_deserializers={
'application/x-www-form-urlencoded': lambda v: v if isinstance(v, dict) else dict(urllib.parse.parse_qsl(v)),
},
) |
Codecov Report
@@ Coverage Diff @@
## master #271 +/- ##
==========================================
+ Coverage 96.75% 96.77% +0.01%
==========================================
Files 122 122
Lines 2436 2448 +12
==========================================
+ Hits 2357 2369 +12
Misses 79 79
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests, removed py3 specific typing. LGTM
@eyadgaran thank you for the contribution. |
Use requests.PreparedRequest object to convert requests.Request into a formatted payload before converting into an OpenAPI request.
Fixes bug where one of the many requests.Request convenience methods (ex json) are used and payload is not stored in Request.data. Should also handle scenarios where persistent sessions have expected headers not applied to the request object until it is prepared and sent