13393: Make queryParams known to UriComponents builder so it can

properly encode them
This commit is contained in:
Aharon Hacmon
2022-11-27 16:16:28 +02:00
parent d5ce79ac24
commit 5a265cc419

View File

@@ -674,16 +674,18 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
Map<String,Object> uriParams = new HashMap<>();
uriParams.putAll(pathParams);
String finalUri = path;
String queryUri = null;
if (queryParams != null && !queryParams.isEmpty()) {
//Include queryParams in uriParams taking into account the paramName
String queryUri = generateQueryUri(queryParams, uriParams);
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
finalUri += "?" + queryUri;
String query = generateQueryUri(queryParams, uriParams);
queryUri = expandPath("?" + query, uriParams).substring(1); //exclude the '?'
//queryUri is the templatized query string like "?param1={param1Value}&.......
}
String expandedPath = this.expandPath(finalUri, uriParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
String expandedPath = this.expandPath(path, uriParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath)
.path(expandedPath)
.query(queryUri);
URI uri;
try {