Skip to content

Commit 2985c2b

Browse files
committed
undertow: 2.4.0.Final
- encode query parameters - fix #3948
1 parent 375d06c commit 2985c2b

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

modules/jooby-undertow/src/main/java/io/jooby/internal/undertow/UndertowHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
5252
if (context.isHttpGet()) {
5353
router.match(context).execute(context);
5454
} else {
55-
// possibly HTTP body
55+
// possibly HTTP body
5656
HeaderMap headers = exchange.getRequestHeaders();
5757
long len = parseLen(headers.getFirst(Headers.CONTENT_LENGTH));
5858
String chunked = headers.getFirst(Headers.TRANSFER_ENCODING);

tests/src/test/java/io/jooby/i2525/Issue2525.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import static org.junit.jupiter.api.Assertions.assertEquals;
99

10+
import java.util.Map;
11+
1012
import io.jooby.jackson.Jackson2Module;
1113
import io.jooby.junit.ServerTest;
1214
import io.jooby.junit.ServerTestRunner;
@@ -36,8 +38,16 @@ public void shouldHandleMultipleAcceptHeaders(ServerTestRunner runner) {
3638
rsp -> {
3739
assertEquals("[]", rsp.body().string());
3840
});
41+
Map<String, Object> queryParams =
42+
Map.of(
43+
"foo[0][a]", 10,
44+
"foo[0][b]", 20,
45+
"foo[1][a]", 30,
46+
"foo[1][b]", 40,
47+
"something", "else");
3948
http.get(
40-
"/2525?foo[0][a]=10&foo[0][b]=20&foo[1][a]=30&foo[1][b]=40&something=else",
49+
"/2525",
50+
queryParams,
4151
rsp -> {
4252
assertEquals("[{\"a\":10,\"b\":20},{\"a\":30,\"b\":40}]", rsp.body().string());
4353
});

tests/src/test/java/io/jooby/i3863/AbstractTrpcProtocolTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ void shouldHandleBasicAndMultiArgumentCalls(ServerTestRunner runner) {
6868
});
6969

7070
// Search (Multi-Argument Tuple)
71+
Map<String, Object> queryMap = Map.of("input", "[\"Pulp Fiction\", 1994]");
7172
http.get(
72-
"/trpc/movies.search?input=[\"Pulp Fiction\", 1994]",
73+
"/trpc/movies.search",
74+
queryMap,
7375
rsp -> {
7476
assertThat(rsp.code()).isEqualTo(200);
7577
assertThat(rsp.body().string())
@@ -195,8 +197,10 @@ void shouldHandleNullabilityValidation(ServerTestRunner runner) {
195197
.ready(
196198
http -> {
197199
// Validating a nullable parameter is accepted (Integer)
200+
Map<String, Object> input = Map.of("input", "[\"The Godfather\", null]");
198201
http.get(
199-
"/trpc/movies.search?input=[\"The Godfather\", null]",
202+
"/trpc/movies.search",
203+
input,
200204
rsp -> {
201205
assertThat(rsp.code()).isEqualTo(200);
202206
assertThat(rsp.body().string()).contains("\"The Godfather\"");

0 commit comments

Comments
 (0)