vovk 3.0.0-draft.424 → 3.0.0-draft.425
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/VovkApp.js +11 -6
- package/mjs/VovkApp.js +11 -6
- package/package.json +1 -1
package/cjs/VovkApp.js
CHANGED
|
@@ -68,11 +68,13 @@ class VovkApp {
|
|
|
68
68
|
const pathStr = path.join('/');
|
|
69
69
|
let methodKey = handlers[pathStr] ? pathStr : null;
|
|
70
70
|
if (!methodKey) {
|
|
71
|
-
const methodKeys =
|
|
71
|
+
const methodKeys = [];
|
|
72
|
+
for (const p of Object.keys(handlers)) {
|
|
72
73
|
const routeSegments = p.split('/');
|
|
73
74
|
if (routeSegments.length !== path.length)
|
|
74
|
-
|
|
75
|
+
continue;
|
|
75
76
|
const params = {};
|
|
77
|
+
let isMatch = true;
|
|
76
78
|
for (let i = 0; i < routeSegments.length; i++) {
|
|
77
79
|
const routeSegment = routeSegments[i];
|
|
78
80
|
const pathSegment = path[i];
|
|
@@ -97,13 +99,16 @@ class VovkApp {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
else if (routeSegment !== pathSegment) {
|
|
100
|
-
// If it's a literal segment and it does not match the corresponding path segment,
|
|
101
|
-
|
|
102
|
+
// If it's a literal segment and it does not match the corresponding path segment, skip this route
|
|
103
|
+
isMatch = false;
|
|
104
|
+
break;
|
|
102
105
|
}
|
|
103
106
|
}
|
|
107
|
+
if (!isMatch)
|
|
108
|
+
continue;
|
|
104
109
|
methodParams = params;
|
|
105
|
-
|
|
106
|
-
}
|
|
110
|
+
methodKeys.push(p);
|
|
111
|
+
}
|
|
107
112
|
if (methodKeys.length > 1) {
|
|
108
113
|
throw new HttpException_1.HttpException(types_1.HttpStatus.INTERNAL_SERVER_ERROR, `Conflicting routes found: ${methodKeys.join(', ')}`);
|
|
109
114
|
}
|
package/mjs/VovkApp.js
CHANGED
|
@@ -68,11 +68,13 @@ class VovkApp {
|
|
|
68
68
|
const pathStr = path.join('/');
|
|
69
69
|
let methodKey = handlers[pathStr] ? pathStr : null;
|
|
70
70
|
if (!methodKey) {
|
|
71
|
-
const methodKeys =
|
|
71
|
+
const methodKeys = [];
|
|
72
|
+
for (const p of Object.keys(handlers)) {
|
|
72
73
|
const routeSegments = p.split('/');
|
|
73
74
|
if (routeSegments.length !== path.length)
|
|
74
|
-
|
|
75
|
+
continue;
|
|
75
76
|
const params = {};
|
|
77
|
+
let isMatch = true;
|
|
76
78
|
for (let i = 0; i < routeSegments.length; i++) {
|
|
77
79
|
const routeSegment = routeSegments[i];
|
|
78
80
|
const pathSegment = path[i];
|
|
@@ -97,13 +99,16 @@ class VovkApp {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
else if (routeSegment !== pathSegment) {
|
|
100
|
-
// If it's a literal segment and it does not match the corresponding path segment,
|
|
101
|
-
|
|
102
|
+
// If it's a literal segment and it does not match the corresponding path segment, skip this route
|
|
103
|
+
isMatch = false;
|
|
104
|
+
break;
|
|
102
105
|
}
|
|
103
106
|
}
|
|
107
|
+
if (!isMatch)
|
|
108
|
+
continue;
|
|
104
109
|
methodParams = params;
|
|
105
|
-
|
|
106
|
-
}
|
|
110
|
+
methodKeys.push(p);
|
|
111
|
+
}
|
|
107
112
|
if (methodKeys.length > 1) {
|
|
108
113
|
throw new HttpException_1.HttpException(types_1.HttpStatus.INTERNAL_SERVER_ERROR, `Conflicting routes found: ${methodKeys.join(', ')}`);
|
|
109
114
|
}
|