projects
/
squeep-api-dingus
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ctx.matchedPath now stores raw route rather than processed array
[squeep-api-dingus]
/
lib
/
router
/
index.js
diff --git
a/lib/router/index.js
b/lib/router/index.js
index f0d2d945a53909c327ab1661c54e83e9a6cfe097..1585065e14ce79b804cd6de967965951ab0d535a 100644
(file)
--- a/
lib/router/index.js
+++ b/
lib/router/index.js
@@
-69,6
+69,12
@@
class Router {
}
routePath[kPathMethods] = {};
}
routePath[kPathMethods] = {};
+
+ Object.defineProperty(routePath, 'path', {
+ enumerable: false,
+ value: rawPath,
+ });
+
Object.freeze(routePath);
return routePath;
}
Object.freeze(routePath);
return routePath;
}
@@
-253,7
+259,7
@@
class Router {
const { matchedPath, pathParams } = this._pathFind(pathParts);
ctx.params = pathParams;
if (matchedPath) {
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];
}
if (method in matchedPath[kPathMethods]) {
return matchedPath[kPathMethods][method];
}