forked from loafle/openapi-generator-original
update java webclient sample
This commit is contained in:
parent
ece48d0bbc
commit
8b64f4d03e
@ -551,23 +551,11 @@ public class ApiClient {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
|
||||
if (queryParams != null) {
|
||||
//encode the query parameters in case they contain unsafe characters
|
||||
for (List<String> values : queryParams.values()) {
|
||||
if (values != null) {
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
try {
|
||||
values.set(i, URLEncoder.encode(values.get(i), "utf8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (queryParams != null) {
|
||||
builder.queryParams(queryParams);
|
||||
}
|
||||
|
||||
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.encode().toUriString(), pathParams);
|
||||
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build(false).toUriString(), pathParams);
|
||||
if(accept != null) {
|
||||
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user