forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quarkus-rest-client-reactive does not URL encode some @QueryParam va…
…lues issue quarkusio#24426
- Loading branch information
Showing
2 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...t/java/io/quarkus/jaxrs/client/reactive/deployment/test/QueryParamNoTemplateTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package io.quarkus.jaxrs.client.reactive.deployment.test; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.quarkus.test.common.http.TestHTTPResource; | ||
import io.vertx.core.Handler; | ||
import io.vertx.ext.web.Router; | ||
import io.vertx.ext.web.RoutingContext; | ||
import org.jboss.resteasy.reactive.client.impl.UniInvoker; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import java.net.URL; | ||
import java.util.stream.Collectors; | ||
import javax.enterprise.event.Observes; | ||
import javax.ws.rs.client.Client; | ||
import javax.ws.rs.client.ClientBuilder; | ||
|
||
public class QueryParamNoTemplateTestCase { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Endpoint.class)); | ||
|
||
@TestHTTPResource | ||
URL url; | ||
|
||
private Client client; | ||
|
||
@BeforeEach | ||
public void before() { | ||
client = ClientBuilder.newBuilder().build(); | ||
} | ||
|
||
@AfterEach | ||
public void after() { | ||
client.close(); | ||
} | ||
|
||
@Test | ||
public void testInjection() { | ||
Object data = client.target(url.toExternalForm() + "/hello") | ||
.queryParam("param", "{foo&bar}", "%FF") | ||
.request() | ||
.rx(UniInvoker.class) | ||
.get() | ||
.await() | ||
.indefinitely(); | ||
Assertions.assertEquals("{foo&bar},%FF", data); | ||
} | ||
|
||
public static class Endpoint { | ||
|
||
public void setup(@Observes Router router) { | ||
router.route("/hello").handler(new Handler<RoutingContext>() { | ||
@Override | ||
public void handle(RoutingContext event) { | ||
event.response() | ||
.end( | ||
event.queryParam("param") | ||
.stream() | ||
.sorted() | ||
.collect(Collectors.joining(",")) | ||
); | ||
} | ||
}); | ||
} | ||
|
||
} | ||
|
||
} |