Skip to content

Commit 1c75a82

Browse files
committed
Example for parsing nested param values #1312
1 parent 9795b65 commit 1c75a82

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.jooby.issues;
2+
3+
import org.jooby.test.ServerFeature;
4+
import org.junit.Test;
5+
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
import java.util.Optional;
9+
10+
public class Issue1312 extends ServerFeature {
11+
12+
public static class Person {
13+
String name;
14+
15+
String country;
16+
17+
Person child;
18+
19+
20+
@Override
21+
public String toString() {
22+
String data = name + " " + country;
23+
if (child!=null) {
24+
data += "; child {" + child.toString() + "}";
25+
}
26+
return data;
27+
}
28+
}
29+
30+
{
31+
get("/", req -> {
32+
return req.params(Person.class);
33+
});
34+
35+
}
36+
37+
@Test
38+
public void rootList() throws Exception {
39+
request()
40+
.get("/?name=P&country=AR&child.name=X&child.country=UY")
41+
.expect("[Pedro PicaPiedra]");
42+
}
43+
44+
}

0 commit comments

Comments
 (0)