forked from loafle/openapi-generator-original
Allow to pass a str to the Python aiohttp client (#18985)
* see #18972 Add support for `str` * update python samples --------- Co-authored-by: David Riccitelli <david@wordlift.io>
This commit is contained in:
parent
4e89436177
commit
1064cb6a68
@ -177,10 +177,10 @@ class RESTClientObject:
|
|||||||
data.add_field(k, v)
|
data.add_field(k, v)
|
||||||
args["data"] = data
|
args["data"] = data
|
||||||
|
|
||||||
# Pass a `bytes` parameter directly in the body to support
|
# Pass a `bytes` or `str` parameter directly in the body to support
|
||||||
# other content types than Json when `body` argument is provided
|
# other content types than Json when `body` argument is provided
|
||||||
# in serialized form
|
# in serialized form
|
||||||
elif isinstance(body, bytes):
|
elif isinstance(body, str) or isinstance(body, bytes):
|
||||||
args["data"] = body
|
args["data"] = body
|
||||||
else:
|
else:
|
||||||
# Cannot generate the request from given parameters
|
# Cannot generate the request from given parameters
|
||||||
|
@ -187,10 +187,10 @@ class RESTClientObject:
|
|||||||
data.add_field(k, v)
|
data.add_field(k, v)
|
||||||
args["data"] = data
|
args["data"] = data
|
||||||
|
|
||||||
# Pass a `bytes` parameter directly in the body to support
|
# Pass a `bytes` or `str` parameter directly in the body to support
|
||||||
# other content types than Json when `body` argument is provided
|
# other content types than Json when `body` argument is provided
|
||||||
# in serialized form
|
# in serialized form
|
||||||
elif isinstance(body, bytes):
|
elif isinstance(body, str) or isinstance(body, bytes):
|
||||||
args["data"] = body
|
args["data"] = body
|
||||||
else:
|
else:
|
||||||
# Cannot generate the request from given parameters
|
# Cannot generate the request from given parameters
|
||||||
|
Loading…
x
Reference in New Issue
Block a user