diff --git a/openapi/templates/api_client.mustache b/openapi/templates/api_client.mustache index 3580c8ff9..727874c23 100644 --- a/openapi/templates/api_client.mustache +++ b/openapi/templates/api_client.mustache @@ -522,10 +522,13 @@ class ApiClient: if isinstance(v, dict): v = json.dumps(v) + encoded_key = quote(str(k)) if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, str(value)) for value in v) + new_params.extend( + (encoded_key, quote(str(value))) for value in v + ) else: if collection_format == 'ssv': delimiter = ' ' @@ -536,10 +539,10 @@ class ApiClient: else: # csv is the default delimiter = ',' new_params.append( - (k, delimiter.join(quote(str(value)) for value in v)) + (encoded_key, delimiter.join(quote(str(value)) for value in v)) ) else: - new_params.append((k, quote(str(v)))) + new_params.append((encoded_key, quote(str(v)))) return "&".join(["=".join(map(str, item)) for item in new_params]) diff --git a/src/rapidata/api_client/api_client.py b/src/rapidata/api_client/api_client.py index 52710c19d..841818463 100644 --- a/src/rapidata/api_client/api_client.py +++ b/src/rapidata/api_client/api_client.py @@ -514,10 +514,13 @@ def parameters_to_url_query(self, params, collection_formats): if isinstance(v, dict): v = json.dumps(v) + encoded_key = quote(str(k)) if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, str(value)) for value in v) + new_params.extend( + (encoded_key, quote(str(value))) for value in v + ) else: if collection_format == 'ssv': delimiter = ' ' @@ -528,10 +531,10 @@ def parameters_to_url_query(self, params, collection_formats): else: # csv is the default delimiter = ',' new_params.append( - (k, delimiter.join(quote(str(value)) for value in v)) + (encoded_key, delimiter.join(quote(str(value)) for value in v)) ) else: - new_params.append((k, quote(str(v)))) + new_params.append((encoded_key, quote(str(v)))) return "&".join(["=".join(map(str, item)) for item in new_params])