Comparing version 1.0.1 to 1.0.2
@@ -5,3 +5,3 @@ var http = require("http"); | ||
//parameters are between {curlybraces} | ||
var routes = ["GET /", "GET /dogs/{dog}", "GET /cats/{cat}"]; | ||
var routes = ["GET /", "GET /dogs/{dog}", "GET /cats/{cat}", "GET /boing"]; | ||
@@ -8,0 +8,0 @@ //overalls is configured with an array or object with paths |
@@ -8,3 +8,4 @@ function splitPath (path) { | ||
if (!routeSegment || !requestSegment) { | ||
if (typeof routeSegment === "undefined" || typeof requestSegment === "undefined") { | ||
return false; | ||
@@ -62,5 +63,7 @@ } | ||
var i, match, il = requestSegments.length; | ||
if(requestSegments.length !== routeSegments.length) { | ||
return; | ||
} | ||
for (i = 0; i < il; i += 1) { | ||
@@ -76,3 +79,4 @@ match = compareSegments(routeSegments[i], requestSegments[i]); | ||
} | ||
if (i === il-1 && match) { | ||
if ((i === (il-1)) && match) { | ||
req.match = routeSegments.join("/"); | ||
@@ -79,0 +83,0 @@ } |
{ | ||
"name": "overalls", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Decorate HTTP requests with path parameters", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13783