X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Frouter%2Findex.js;h=1585065e14ce79b804cd6de967965951ab0d535a;hb=cea77553ae5746713defff5528a475c702797f37;hp=f0d2d945a53909c327ab1661c54e83e9a6cfe097;hpb=1296167385b38ca226f17c3a87ac2135d53c769b;p=squeep-api-dingus diff --git a/lib/router/index.js b/lib/router/index.js index f0d2d94..1585065 100644 --- a/lib/router/index.js +++ b/lib/router/index.js @@ -69,6 +69,12 @@ class Router { } routePath[kPathMethods] = {}; + + Object.defineProperty(routePath, 'path', { + enumerable: false, + value: rawPath, + }); + Object.freeze(routePath); return routePath; } @@ -253,7 +259,7 @@ class Router { const { matchedPath, pathParams } = this._pathFind(pathParts); ctx.params = pathParams; if (matchedPath) { - ctx.matchedPath = matchedPath; + ctx.matchedPath = matchedPath.path; if (method in matchedPath[kPathMethods]) { return matchedPath[kPathMethods][method]; }