Additional tests for prefix paths and path params#2396
Additional tests for prefix paths and path params#2396synth3 wants to merge 1 commit intovert-x3:masterfrom
Conversation
| // should call "/:id/*" | ||
| testRequest(HttpMethod.GET, "/123", 200, "OK", "r1"); | ||
| // should call "/a/:id/*" | ||
| testRequest(HttpMethod.GET, "/a/123", 200, "OK", "r2"); | ||
| testRequest(HttpMethod.GET, "/a//123", 200, "OK", "r2"); | ||
| // should call "/a/:id/b1/*" | ||
| testRequest(HttpMethod.GET, "/a/123/b1", 200, "OK", "r3"); | ||
| testRequest(HttpMethod.GET, "/a//123//b1", 200, "OK", "r3"); | ||
| // should call "/a/:id/b/:id2/c/*" | ||
| testRequest(HttpMethod.GET, "/a/123/b/1234/c", 200, "OK", "r4"); | ||
| testRequest(HttpMethod.GET, "/a//123//b//1234//c", 200, "OK", "r4"); | ||
| } |
There was a problem hiding this comment.
These assumptions are incorrect according to the rules the matching engine works.
A wildcard route is a route that ends with: * however it is important to note that the final slash is significant. At the HTTP spec level: http://server/a and http://server/a/ are considered 2 different resources. In vertx-web we claim that for simplicity, a static route that doesn't include the final / will match both requests to the same route, however, the routes in this example end with /* which means that the final / is significative. This means the request must include it to be matched.
There was a problem hiding this comment.
Thanks alot for the explanation! There might still be some inconsistencies in documentation and/or behavior - see also #2395 (comment)
Motivation:
Additional router tests and reproducer for #2395.