feat: support multiple middlewares with the same matcher (#553)

This commit is contained in:
ahuigo
2022-08-23 23:50:57 +02:00
committed by GitHub
parent 6c2291f0de
commit a00b97bac9
6 changed files with 99 additions and 11 deletions
+8 -1
View File
@@ -320,7 +320,14 @@ export class ServerContext {
};
for (const mw of mws) {
handlers.push(() => mw.handler(req, ctx));
if (mw.handler instanceof Array) {
for (const handler of mw.handler) {
handlers.push(() => handler(req, ctx));
}
} else {
const handler = mw.handler;
handlers.push(() => handler(req, ctx));
}
}
handlers.push(() => inner(req, ctx));