Make route extraction account for extraneous / matches
This commit is contained in:
parent
8b2ee1c949
commit
2e7c927114
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@extollo/lib",
|
"name": "@extollo/lib",
|
||||||
"version": "0.9.30",
|
"version": "0.9.31",
|
||||||
"description": "The framework library that lifts up your code.",
|
"description": "The framework library that lifts up your code.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@ -275,11 +275,11 @@ export class Route<TReturn extends ResponseObject, THandlerParams extends unknow
|
|||||||
* @param potential
|
* @param potential
|
||||||
*/
|
*/
|
||||||
public extract(potential: string): {[key: string]: string} | undefined {
|
public extract(potential: string): {[key: string]: string} | undefined {
|
||||||
const routeParts = (this.route.startsWith('/') ? this.route.substr(1) : this.route).split('/')
|
const routeParts = (this.route.startsWith('/') ? this.route.substr(1) : this.route).split('/').filter(Boolean)
|
||||||
const potentialParts = (potential.startsWith('/') ? potential.substr(1) : potential).split('/')
|
const potentialParts = (potential.startsWith('/') ? potential.substr(1) : potential).split('/').filter(Boolean)
|
||||||
|
|
||||||
Application.getApplication().make<Logging>(Logging)
|
Application.getApplication().make<Logging>(Logging)
|
||||||
.verbose(`Extracting route - (potential: ${potential}, rP: ${JSON.stringify(routeParts)}, pP: ${JSON.stringify(potentialParts)})`)
|
.trace(`Extracting route - (potential: ${potential}, rP: ${JSON.stringify(routeParts)}, pP: ${JSON.stringify(potentialParts)})`)
|
||||||
|
|
||||||
const params: any = {}
|
const params: any = {}
|
||||||
let wildcardIdx = 0
|
let wildcardIdx = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user