Skip to content

Commit

Permalink
Removal of Encoding in the Query-Params in order to prevent double En…
Browse files Browse the repository at this point in the history
…coding. (OpenAPITools#5255)

This way letting WebClient do its Job in encoding the URL.
  • Loading branch information
dwlabcube authored and MikailBag committed Mar 23, 2020
1 parent 92bd0c7 commit 7bd6e0a
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,23 +555,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()]));
}
Expand Down

0 comments on commit 7bd6e0a

Please sign in to comment.