-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
quarkus-rest-client-reactive does not URL encode some @QueryParam values #24426
Comments
Thanks for the detailed analysis @plevart . @michalszynkiewicz @geoand let's try to fix this before CR1 if we can. |
Perhaps the following method should be called from the generated |
@plevart maybe you want to try to prepare a PR with a test? Even just the test would be helpful. |
@michalszynkiewicz I vaguely remember this coming up before... |
there was something similar, a request to support |
Describe the bug
When the value of a query parameter contains a pattern
{ ... anything ...}
or%<hex-digit><hex-digit>
that part of the value is left untouched and not URL encoded. This can then result in wrong invocations of REST service or in exceptions such as this:The culprit is the class
org.jboss.resteasy.reactive.client.impl.WebTargetImpl
which uses its embeddeduriBuilder
in the wrong way. When adding query parameters to it, it uses method:javax.ws.rs.core.UriBuilder#queryParam
:But there is another method on the implementation class of the UriBuilder, the
org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl#clientQueryParam
(not part of UriBuilder interface unfortunately) which should be more appropriate for the client and states the following:Expected behavior
Passing any string as @QueryParam should be possible as URL encoding should be used.
Actual behavior
When the value of a query parameter contains a pattern
{ ... anything ...}
or%<hex-digit><hex-digit>
that part of the value is left untouched and not URL encoded.How to Reproduce?
test:
Output of
uname -a
orver
Linux sun 5.14.18-100.fc33.x86_64 #1 SMP Fri Nov 12 17:38:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment 21.9 (build 17.0.1+12) OpenJDK 64-Bit Server VM 21.9 (build 17.0.1+12, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.7.5.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /home/peter/JavaApps/apache-maven-3 Java version: 17.0.1, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.1.0.12-2.rolling.fc33.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.14.18-100.fc33.x86_64", arch: "amd64", family: "unix"
Additional information
Not that
quarkus-rest-client
does not have this problem.The text was updated successfully, but these errors were encountered: