fast-koa-router
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -1,1 +0,1 @@ | ||
{"processes":{"373b3c77-f04a-41e7-90e5-ec602ca50297":{"parent":null,"children":[]}},"files":{"/home/runner/work/fast-koa-router/fast-koa-router/src/middleware.ts":["373b3c77-f04a-41e7-90e5-ec602ca50297"],"/home/runner/work/fast-koa-router/fast-koa-router/src/router.ts":["373b3c77-f04a-41e7-90e5-ec602ca50297"],"/home/runner/work/fast-koa-router/fast-koa-router/src/parse.ts":["373b3c77-f04a-41e7-90e5-ec602ca50297"]},"externalIds":{}} | ||
{"processes":{"d1d2240f-eb7c-4557-be0d-cb350be1a6e8":{"parent":null,"children":[]}},"files":{"/home/runner/work/fast-koa-router/fast-koa-router/src/middleware.ts":["d1d2240f-eb7c-4557-be0d-cb350be1a6e8"],"/home/runner/work/fast-koa-router/fast-koa-router/src/router.ts":["d1d2240f-eb7c-4557-be0d-cb350be1a6e8"],"/home/runner/work/fast-koa-router/fast-koa-router/src/parse.ts":["d1d2240f-eb7c-4557-be0d-cb350be1a6e8"]},"externalIds":{}} |
@@ -93,6 +93,4 @@ "use strict"; | ||
} | ||
const params = {}; | ||
let _matchedRoute = ''; | ||
routes = routes[method] || {}; | ||
if (routes[path]) { | ||
if (routes[path] && routes[path].middleware) { | ||
return { middleware: routes[path].middleware, _matchedRoute: path }; | ||
@@ -99,0 +97,0 @@ } |
{ | ||
"name": "fast-koa-router", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/middleware.js", |
@@ -201,2 +201,37 @@ import * as assert from 'assert'; | ||
it('star path should also match with path not ending with /', function () { | ||
let routes = handlePathVariables( | ||
addPrefixMiddleware( | ||
parse({ | ||
get: { | ||
'/path': ['middleware'], | ||
'/path/1': ['one'], | ||
'/path/1/3/foo': ['foo'], | ||
'/foo/*': ['star'], | ||
'/*': ['initialStar'] | ||
} | ||
}), | ||
{ '/path': 'prefix' } | ||
) | ||
); | ||
assert.deepStrictEqual(getPathMethod(routes, '/foo/', 'get'), { | ||
_matchedRoute: '/foo/*', | ||
params: {}, | ||
middleware: ['star'] | ||
}); | ||
assert.deepStrictEqual(getPathMethod(routes, '/foo', 'get'), { | ||
_matchedRoute: '/foo/*', | ||
params: {}, | ||
middleware: ['star'] | ||
}); | ||
assert.deepStrictEqual(getPathMethod(routes, '/foobar', 'get'), { | ||
_matchedRoute: '/*', | ||
params: {}, | ||
middleware: ['initialStar'] | ||
}); | ||
}); | ||
it('star path should also work with many params in path', function () { | ||
@@ -203,0 +238,0 @@ let routes = handlePathVariables( |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113950
1148