Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
if (context.isHttpGet()) {
router.match(context).execute(context);
} else {
// possibly HTTP body
// possibly HTTP body
HeaderMap headers = exchange.getRequestHeaders();
long len = parseLen(headers.getFirst(Headers.CONTENT_LENGTH));
String chunked = headers.getFirst(Headers.TRANSFER_ENCODING);
Expand Down
12 changes: 11 additions & 1 deletion tests/src/test/java/io/jooby/i2525/Issue2525.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

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

import java.util.Map;

import io.jooby.jackson.Jackson2Module;
import io.jooby.junit.ServerTest;
import io.jooby.junit.ServerTestRunner;
Expand Down Expand Up @@ -36,8 +38,16 @@ public void shouldHandleMultipleAcceptHeaders(ServerTestRunner runner) {
rsp -> {
assertEquals("[]", rsp.body().string());
});
Map<String, Object> queryParams =
Map.of(
"foo[0][a]", 10,
"foo[0][b]", 20,
"foo[1][a]", 30,
"foo[1][b]", 40,
"something", "else");
http.get(
"/2525?foo[0][a]=10&foo[0][b]=20&foo[1][a]=30&foo[1][b]=40&something=else",
"/2525",
queryParams,
rsp -> {
assertEquals("[{\"a\":10,\"b\":20},{\"a\":30,\"b\":40}]", rsp.body().string());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ void shouldHandleBasicAndMultiArgumentCalls(ServerTestRunner runner) {
});

// Search (Multi-Argument Tuple)
Map<String, Object> queryMap = Map.of("input", "[\"Pulp Fiction\", 1994]");
http.get(
"/trpc/movies.search?input=[\"Pulp Fiction\", 1994]",
"/trpc/movies.search",
queryMap,
rsp -> {
assertThat(rsp.code()).isEqualTo(200);
assertThat(rsp.body().string())
Expand Down Expand Up @@ -195,8 +197,10 @@ void shouldHandleNullabilityValidation(ServerTestRunner runner) {
.ready(
http -> {
// Validating a nullable parameter is accepted (Integer)
Map<String, Object> input = Map.of("input", "[\"The Godfather\", null]");
http.get(
"/trpc/movies.search?input=[\"The Godfather\", null]",
"/trpc/movies.search",
input,
rsp -> {
assertThat(rsp.code()).isEqualTo(200);
assertThat(rsp.body().string()).contains("\"The Godfather\"");
Expand Down
Loading