NestedParamsMiddleware extends AbstractWebMiddleware<HttpRequest, NRES> { public HttpRequest nestedParamsRequest(HttpRequest request, Function<String, String[]> keyParser) { Parameters params = request.getParams(); Parameters nestedParams = Parameters.empty(); params.keySet().forEach(key -> assocNested(nestedParams, keyParser.apply(key), params.getList(key))); request.setParams(nestedParams); return request; }  HttpRequest nestedParamsRequest(HttpRequest request, Function<String, String[]> keyParser); @Override HttpResponse handle(HttpRequest request, MiddlewareChain<HttpRequest, NRES, ?, ?> chain);  }
@Test void testNestedParamsRequest() { HttpRequest request = new DefaultHttpRequest(); request.setParams(Parameters.of( "foo[aaa]", "a3", "foo[bbb]", "b3", "bar[][telNo]", "090")); nestedParamsRequest(request, parseNestedKeys); assertThat(request.getParams().getIn("bar", "0", "telNo")) .isEqualTo("090"); }