Fix trailing slash in nested path

This commit adds a trailing slash to the nested path if the request path
also ends with a slash. For instance, given the request "/foo/bar/", and
nested path pattern "/foo/**", we expect the nested path to be “/bar/”,
not “/bar".
This commit is contained in:
Arjen Poutsma 2017-02-21 13:43:59 +01:00
parent babd5517aa
commit 7582adc0bc
1 changed files with 3 additions and 0 deletions

View File

@ -386,6 +386,9 @@ public abstract class RequestPredicates {
if (!subPath.startsWith("/")) {
subPath = "/" + subPath;
}
if (requestPath.endsWith("/") && !subPath.endsWith("/")) {
subPath += "/";
}
return new SubPathServerRequestWrapper(request, subPath);
}