[Java] [apache-httpclient] Fix issue with toString causing wrong value with collections (#19576)

* Fix issue with toString causing wrong value with collections

With collections, calling toString will result in the value becoming [a,b] instead of just a,b.

Using the existing apiClient::parameterToString method ensures it gets parsed correctly if it is a collection

* Updated samples

---------

Co-authored-by: Rasmus Zweidorff Iversen <rzi@jysk.com>
This commit is contained in:
Rasmus Zweidorff Iversen
2024-09-17 11:57:35 +02:00
committed by GitHub
parent 30b1a74979
commit fd85359548
5 changed files with 15 additions and 15 deletions

View File

@@ -92,10 +92,10 @@ public class PathApi extends BaseApi {
// create path and map variables
String localVarPath = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}"
.replaceAll("\\{" + "path_string" + "\\}", apiClient.escapeString(pathString.toString()))
.replaceAll("\\{" + "path_integer" + "\\}", apiClient.escapeString(pathInteger.toString()))
.replaceAll("\\{" + "enum_nonref_string_path" + "\\}", apiClient.escapeString(enumNonrefStringPath.toString()))
.replaceAll("\\{" + "enum_ref_string_path" + "\\}", apiClient.escapeString(enumRefStringPath.toString()));
.replaceAll("\\{" + "path_string" + "\\}", apiClient.escapeString(apiClient.parameterToString(pathString)))
.replaceAll("\\{" + "path_integer" + "\\}", apiClient.escapeString(apiClient.parameterToString(pathInteger)))
.replaceAll("\\{" + "enum_nonref_string_path" + "\\}", apiClient.escapeString(apiClient.parameterToString(enumNonrefStringPath)))
.replaceAll("\\{" + "enum_ref_string_path" + "\\}", apiClient.escapeString(apiClient.parameterToString(enumRefStringPath)));
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;