WP_Route icon indicating copy to clipboard operation
WP_Route copied to clipboard

Match route to request

Open mytuny opened this issue 6 years ago • 0 comments

Problem:

Defined route:

WP_Route::get('flights', 'callbackFn');

Any of the following request URIs will match with the above route definition and 'callbackFn' get fired: "/flight", "/anytext", "/tttttttt", "eeee" ...etc

Fix:

An additional utility method called "matchRouteToRequest" has been added. Then, we add a filter inside the 'handler' to filter-out the routes with a pattern that do not match the requested URI.

mytuny avatar Jun 11 '19 16:06 mytuny