mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
Fix parameters_to_url_query doesn't properly convert lists to string (#17592)
* fix parameters_to_url_query to properly handle lists
* fix query parameters bug in sample clients
* add tests for url query list value
* build project
* tests fix
* Revert "build project"
This reverts commit a486a6de75.
This commit is contained in:
@@ -539,7 +539,7 @@ class ApiClient:
|
||||
if k in collection_formats:
|
||||
collection_format = collection_formats[k]
|
||||
if collection_format == 'multi':
|
||||
new_params.extend((k, value) for value in v)
|
||||
new_params.extend((k, str(value)) for value in v)
|
||||
else:
|
||||
if collection_format == 'ssv':
|
||||
delimiter = ' '
|
||||
|
||||
@@ -149,6 +149,12 @@ class TestManual(unittest.TestCase):
|
||||
client = openapi_client.ApiClient()
|
||||
params = client.parameters_to_url_query([("boolean", True),], {})
|
||||
self.assertEqual(params, "boolean=true")
|
||||
|
||||
def test_parameters_to_url_query_list_value(self):
|
||||
client = openapi_client.ApiClient()
|
||||
params = client.parameters_to_url_query(params=[('list', [1, 2, 3])], collection_formats={'list': 'multi'})
|
||||
self.assertEqual(params, "list=1&list=2&list=3")
|
||||
|
||||
|
||||
def echoServerResponseParaserTest(self):
|
||||
s = """POST /echo/body/Pet/response_string HTTP/1.1
|
||||
|
||||
Reference in New Issue
Block a user