Skip to content

Commit 8b64f4d

Browse files
committed
update java webclient sample
1 parent ece48d0 commit 8b64f4d

File tree

1 file changed

+2
-14
lines changed
  • samples/client/petstore/java/webclient/src/main/java/org/openapitools/client

1 file changed

+2
-14
lines changed

samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -551,23 +551,11 @@ private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method,
551551
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
552552

553553
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
554-
if (queryParams != null) {
555-
//encode the query parameters in case they contain unsafe characters
556-
for (List<String> values : queryParams.values()) {
557-
if (values != null) {
558-
for (int i = 0; i < values.size(); i++) {
559-
try {
560-
values.set(i, URLEncoder.encode(values.get(i), "utf8"));
561-
} catch (UnsupportedEncodingException e) {
562-
563-
}
564-
}
565-
}
566-
}
554+
if (queryParams != null) {
567555
builder.queryParams(queryParams);
568556
}
569557

570-
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.encode().toUriString(), pathParams);
558+
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build(false).toUriString(), pathParams);
571559
if(accept != null) {
572560
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
573561
}

0 commit comments

Comments
 (0)