I am having a problem with WebClient when setting the queryparams. This is the code:
WebClient webClient = WebClient.create(config.getOAuth2Url());
return webClient.post()
.uri(uriBuilder -> uriBuilder
.path("/oauth/authorize")
.queryParam(RESPONSE_TYPE, request.getResponse_type())
.queryParam(CLIENT_ID, request.getClient_id())
.queryParam(REDIRECT_URI, request.getRedirect_uri()) // pay attention here
.build())
.header("cookie", jSessionId)
.acceptCharset(StandardCharsets.UTF_8)
.retrieve()
.toEntity(JsonNode.class)
.block();
The thing is that
request.getRedirect_uri()
is a String with % characters, like this:
https%3A%2F%2Fbra...
And I am getting a 400 error because WebClient is changing in some step this String with:
https%253A%252F%252Fbra
Of course if I try a curl with my original value it works, and if I try the curl with the modified string I get a 400. How can I change WebClient behavior so it doesn't modify my url?