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:
Mark Haley
2023-11-01 11:30:32 -04:00
committed by GitHub
parent 8893c7136a
commit a4267ee630
13 changed files with 34 additions and 22 deletions

View File

@@ -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)

View File

@@ -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