Ensure query parameters are copied when forwarding a request
The prefixed routes were not properly copying query parameters. This
change fixes that.
@@ -259,14 +259,21 @@ private HttpRequest transform(HttpRequest request) {
request.getUri();
HttpRequest toForward = new HttpRequest(request.getMethod(), unprefixed);
+
request.getHeaderNames().forEach(name -> {
if (name == null) {
return;
}
request.getHeaders(name).forEach(value -> toForward.addHeader(name, value));
});
+
request.getAttributeNames().forEach(
attr -> toForward.setAttribute(attr, request.getAttribute(attr)));
+
+ request.getQueryParameterNames().forEach(name -> {
+ request.getQueryParameters(name).forEach(value -> toForward.addQueryParameter(name, value));
+ });
+
toForward.setContent(request.getContent());
return toForward;
