Skip to content

Commit c4d96c2

Browse files
version 1.0.19
1 parent 5487554 commit c4d96c2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uquik",
3-
"version": "1.0.18",
3+
"version": "1.0.19",
44
"description": "uQuik HTTP(S) framework",
55
"main": "index.js",
66
"scripts": {

src/Server.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,9 @@ class Server extends Router {
325325

326326
// Inject middleware into all routes that match its execution pattern if it is non global
327327
if (object.priority !== 0) {
328-
// const match = record.pattern !== '/' && record.pattern.endsWith('/') ? record.pattern.substr(0, record.pattern.length - 1) : record.pattern
329328
this._routes.forEach((method) => {
330329
method.forEach((route, pattern) => {
331-
if ((pattern === '/' && pattern === record.pattern) || (pattern !== '/' && pattern.startsWith(record.pattern))) route.use(object)
330+
if ((record.pattern === '/' && pattern === record.pattern) || (record.pattern !== '/' && pattern.startsWith(record.pattern))) route.use(object)
332331
})
333332
})
334333
}

src/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ const parsePathParameters = (pattern) => {
305305
let counter = 0
306306
if (pattern.indexOf('/:') > -1) {
307307
const chunks = pattern.split('/').filter((chunk) => chunk.length > 0)
308-
for (let index = 0; index < chunks.length; index++) {
308+
const chunksLength = chunks.length
309+
for (let index = 0; index < chunksLength; index++) {
309310
const current = chunks[index]
310311
if (current.startsWith(':') && current.length > 2) {
311312
results.push([current.substring(1), counter])

0 commit comments

Comments
 (0)