Skip to content

Commit

Permalink
udpate to the $findMatchingRoute method to allow for the requestMetho…
Browse files Browse the repository at this point in the history
…d to be overriden as an argument when needing to use this method in strange and interesting ways. AKA breadcrumbs...
  • Loading branch information
James Gibson committed Feb 23, 2012
1 parent 764c2dc commit 4a28d0b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/coldroute.cfc
Expand Up @@ -185,19 +185,17 @@

<cffunction name="$findMatchingRoute" mixin="dispatch" returntype="struct" access="public" hint="Help Wheels match routes using path and HTTP method">
<cfargument name="path" type="string" required="true" />
<cfargument name="requestMethod" type="string" required="false" default="#$getRequestMethod()#" />
<cfscript>
var loc = {};

// get HTTP verb used in request
loc.requestMethod = $getRequestMethod();

// loop over wheels routes
loc.iEnd = ArrayLen(application.wheels.routes);
for (loc.i = 1; loc.i LTE loc.iEnd; loc.i++) {
loc.route = application.wheels.routes[loc.i];

// if method doesn't match, skip this route
if (StructKeyExists(loc.route, "methods") AND NOT ListFindNoCase(loc.route.methods, loc.requestMethod))
if (StructKeyExists(loc.route, "methods") AND NOT ListFindNoCase(loc.route.methods, arguments.requestMethod))
continue;

// make sure route has been converted to regex
Expand Down

0 comments on commit 4a28d0b

Please sign in to comment.