mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
fix parameters_to_url_query returns booleans with upper letter (#16947)
* chore: add test to show python bool url params are not lower case * fix: python parameters_to_url_query template to properly detect booleans * fix: typo in test * fix: typo in test * chore: update test name to snake case and be more descriptive
This commit is contained in:
@@ -476,10 +476,10 @@ class ApiClient:
|
||||
if collection_formats is None:
|
||||
collection_formats = {}
|
||||
for k, v in params.items() if isinstance(params, dict) else params:
|
||||
if isinstance(v, (int, float)):
|
||||
v = str(v)
|
||||
if isinstance(v, bool):
|
||||
v = str(v).lower()
|
||||
if isinstance(v, (int, float)):
|
||||
v = str(v)
|
||||
if isinstance(v, dict):
|
||||
v = json.dumps(v)
|
||||
|
||||
|
||||
@@ -212,6 +212,11 @@ class TestManual(unittest.TestCase):
|
||||
self.assertEqual(pet2.tags[0].name, "None")
|
||||
self.assertEqual(pet2.category.id, 1)
|
||||
|
||||
def test_parameters_to_url_query_boolean_value(self):
|
||||
client = openapi_client.ApiClient()
|
||||
params = client.parameters_to_url_query([("boolean", True),], {})
|
||||
self.assertEqual(params, "boolean=true")
|
||||
|
||||
def echoServerResponseParaserTest(self):
|
||||
s = """POST /echo/body/Pet/response_string HTTP/1.1
|
||||
Host: localhost:3000
|
||||
|
||||
Reference in New Issue
Block a user