forked from loafle/openapi-generator-original
13393: Make queryParams known to UriComponents builder so it can
properly encode them
This commit is contained in:
parent
d34ac8d13b
commit
d6deaf8c7b
@ -597,16 +597,18 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
Map<String,Object> uriParams = new HashMap<>();
|
Map<String,Object> uriParams = new HashMap<>();
|
||||||
uriParams.putAll(pathParams);
|
uriParams.putAll(pathParams);
|
||||||
|
|
||||||
String finalUri = path;
|
String queryUri = null;
|
||||||
|
|
||||||
if (queryParams != null && !queryParams.isEmpty()) {
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
//Include queryParams in uriParams taking into account the paramName
|
//Include queryParams in uriParams taking into account the paramName
|
||||||
String queryUri = generateQueryUri(queryParams, uriParams);
|
String query = generateQueryUri(queryParams, uriParams);
|
||||||
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
|
queryUri = expandPath("?" + query, uriParams).substring(1); //exclude the '?'
|
||||||
finalUri += "?" + queryUri;
|
//queryUri is the templatized query string like "?param1={param1Value}&.......
|
||||||
}
|
}
|
||||||
String expandedPath = this.expandPath(finalUri, uriParams);
|
String expandedPath = this.expandPath(path, uriParams);
|
||||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
|
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath)
|
||||||
|
.path(expandedPath)
|
||||||
|
.query(queryUri);
|
||||||
|
|
||||||
URI uri;
|
URI uri;
|
||||||
try {
|
try {
|
||||||
|
@ -634,16 +634,18 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
Map<String,Object> uriParams = new HashMap<>();
|
Map<String,Object> uriParams = new HashMap<>();
|
||||||
uriParams.putAll(pathParams);
|
uriParams.putAll(pathParams);
|
||||||
|
|
||||||
String finalUri = path;
|
String queryUri = null;
|
||||||
|
|
||||||
if (queryParams != null && !queryParams.isEmpty()) {
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
//Include queryParams in uriParams taking into account the paramName
|
//Include queryParams in uriParams taking into account the paramName
|
||||||
String queryUri = generateQueryUri(queryParams, uriParams);
|
String query = generateQueryUri(queryParams, uriParams);
|
||||||
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
|
queryUri = expandPath("?" + query, uriParams).substring(1); //exclude the '?'
|
||||||
finalUri += "?" + queryUri;
|
//queryUri is the templatized query string like "?param1={param1Value}&.......
|
||||||
}
|
}
|
||||||
String expandedPath = this.expandPath(finalUri, uriParams);
|
String expandedPath = this.expandPath(path, uriParams);
|
||||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
|
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath)
|
||||||
|
.path(expandedPath)
|
||||||
|
.query(queryUri);
|
||||||
|
|
||||||
URI uri;
|
URI uri;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user