Closed Danappelxx closed 8 years ago
It looks like it's not handling wildcards with more than one component correctly.
server.get("/something/*", ...)
will match: /something/else
but not: /something/else/entirely
The problem seems to be here:
guard self.components.count == request.pathComponents.count else {
return false
}
After thinking about it, the route path can never have more components than the request URL, but the request URL can have more components than the route path if there are wildcard paths involved.
Right - I figured that would make more sense anyway - /*/*
does work though. Maybe use /**
where you want it to be recursive?
I'm going to merge this since its a trivial change that doesn't break anything. Regarding @kevinup7's note - I think it makes more sense the way it is implemented right now anyway. /something/*
should not match /something/else/entirely
, because that would mean that /something/*/entirely
matches something/else/else/else/else/else/entirely
, which is (in my opinion) incorrect. If we were to implement this sort of behavior, it should be with the double-globstar **
, not the single kind *
.
Needs review.
Valid statements:
and pretty much anything else involving the wildcard character
*
.I've done some testing on my own but I'm not convinced that it's completely bug-free.