X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Frouter%2Findex.js;fp=lib%2Frouter%2Findex.js;h=1585065e14ce79b804cd6de967965951ab0d535a;hb=5c9113409d3b48549f46f211cd24a39b12118e1a;hp=f0d2d945a53909c327ab1661c54e83e9a6cfe097;hpb=446a6e8fa160483e1c48a575e60a636c9f37927a;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]; }