forked from loafle/openapi-generator-original
* fix for issue #13722: send body for application/x-www-form-urlencoded data * fix python test_application_x_www_form_urlencoded_serialization * x-www-form-urlencoded data needs to be percent encoded * add verification endpoint test for x-www-form-urlencoded data Co-authored-by: David Chaiken <dchaiken@pinterest.com>
This commit is contained in:
@@ -297,7 +297,7 @@ class StyleFormSerializer(ParameterSerializerBase):
|
||||
prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] = None
|
||||
) -> str:
|
||||
if prefix_separator_iterator is None:
|
||||
prefix_separator_iterator = PrefixSeparatorIterator('?', '&')
|
||||
prefix_separator_iterator = PrefixSeparatorIterator('', '&')
|
||||
return self._ref6570_expansion(
|
||||
variable_name=name,
|
||||
in_data=in_data,
|
||||
@@ -1462,7 +1462,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
|
||||
raise ValueError(
|
||||
f'Unable to serialize {in_data} to application/x-www-form-urlencoded because it is not a dict of data')
|
||||
cast_in_data = self.__json_encoder.default(in_data)
|
||||
value = self._serialize_form(cast_in_data, name='', explode=True, percent_encode=False)
|
||||
value = self._serialize_form(cast_in_data, name='', explode=True, percent_encode=True)
|
||||
return dict(body=value)
|
||||
|
||||
def serialize(
|
||||
|
||||
@@ -146,6 +146,7 @@ class RESTClientObject(object):
|
||||
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
|
||||
r = self.pool_manager.request(
|
||||
method, url,
|
||||
body=body,
|
||||
fields=fields,
|
||||
encode_multipart=False,
|
||||
preload_content=not stream,
|
||||
|
||||
Reference in New Issue
Block a user