Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nfkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nfkit
Commits
3bb9cf01
You need to sign in or sign up before continuing.
Commit
3bb9cf01
authored
Feb 07, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
ab5a0c05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
src/middleware-dispatcher/proto-middleware-dispatcher.ts
src/middleware-dispatcher/proto-middleware-dispatcher.ts
+2
-2
tests/proto-middleware-dispatcher.spec.ts
tests/proto-middleware-dispatcher.spec.ts
+16
-2
No files found.
src/middleware-dispatcher/proto-middleware-dispatcher.ts
View file @
3bb9cf01
import
{
Middleware
,
Middleware
Next
,
Middleware
Result
}
from
'
./types
'
;
import
{
Middleware
,
MiddlewareResult
}
from
'
./types
'
;
import
{
AnyClass
,
ClassType
}
from
'
../types
'
;
import
{
AnyClass
,
ClassType
}
from
'
../types
'
;
import
{
DynamicMiddlewareDispatcher
}
from
'
./dynamic-middleware-dispatcher
'
;
import
{
DynamicMiddlewareDispatcher
}
from
'
./dynamic-middleware-dispatcher
'
;
...
@@ -80,7 +80,7 @@ export class ProtoMiddlewareDispatcher<
...
@@ -80,7 +80,7 @@ export class ProtoMiddlewareDispatcher<
for
(
const
cls
of
chain
)
{
for
(
const
cls
of
chain
)
{
const
mws
=
this
.
middlewareProtoMapPrior
.
get
(
cls
);
const
mws
=
this
.
middlewareProtoMapPrior
.
get
(
cls
);
if
(
mws
)
{
if
(
mws
)
{
result
.
push
(...
mws
);
result
.
push
(...
[...
mws
].
reverse
()
);
}
}
}
}
...
...
tests/proto-middleware-dispatcher.spec.ts
View file @
3bb9cf01
...
@@ -13,7 +13,15 @@ describe('ProtoMiddlewareDispatcher', () => {
...
@@ -13,7 +13,15 @@ describe('ProtoMiddlewareDispatcher', () => {
d
.
middleware
(
d
.
middleware
(
Base
,
Base
,
async
(
x
,
inst
,
next
)
=>
{
async
(
x
,
inst
,
next
)
=>
{
order
.
push
(
'
base:prior
'
);
order
.
push
(
'
base:prior1
'
);
return
next
();
},
true
,
);
d
.
middleware
(
Base
,
async
(
x
,
inst
,
next
)
=>
{
order
.
push
(
'
base:prior2
'
);
return
next
();
return
next
();
},
},
true
,
true
,
...
@@ -26,6 +34,10 @@ describe('ProtoMiddlewareDispatcher', () => {
...
@@ -26,6 +34,10 @@ describe('ProtoMiddlewareDispatcher', () => {
},
},
true
,
true
,
);
);
d
.
middleware
(
Sub
,
async
(
x
,
inst
,
next
)
=>
{
order
.
push
(
'
sub:normal0
'
);
return
next
();
});
d
.
middleware
(
Sub
,
async
(
x
,
inst
,
next
)
=>
{
d
.
middleware
(
Sub
,
async
(
x
,
inst
,
next
)
=>
{
order
.
push
(
'
sub:normal
'
);
order
.
push
(
'
sub:normal
'
);
expect
(
inst
).
toBeInstanceOf
(
Sub
);
expect
(
inst
).
toBeInstanceOf
(
Sub
);
...
@@ -47,8 +59,10 @@ describe('ProtoMiddlewareDispatcher', () => {
...
@@ -47,8 +59,10 @@ describe('ProtoMiddlewareDispatcher', () => {
sub
.
value
=
5
;
sub
.
value
=
5
;
const
res
=
await
d
.
dispatch
(
3
,
sub
);
const
res
=
await
d
.
dispatch
(
3
,
sub
);
expect
(
order
).
toEqual
([
expect
(
order
).
toEqual
([
'
base:prior
'
,
'
base:prior2
'
,
'
base:prior1
'
,
'
sub:prior
'
,
'
sub:prior
'
,
'
sub:normal0
'
,
'
sub:normal
'
,
'
sub:normal
'
,
'
base:normal
'
,
'
base:normal
'
,
]);
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment