We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UseBefore Middleware on an endpoint is always called after Use middleware on the controller.
From the doc https://tsed.io/docs/middlewares.html#call-sequences, the sequence is:
MdlwCtrlBefore, MdlwCtrlBeforeEach MdlwBefore, (EndPoint) MdlwCtrl, MyCtrl.endpointA
But from my tests, MdlwBefore is called after MdlwCtrl
import { Controller, Get, Middleware, Use, UseBefore } from "@tsed/common"; import { Tags } from "@tsed/schema"; @Middleware() export class BeforeMiddleware { async use(): Promise<void> { console.log("before") } } @Middleware() export class ControllerMiddleware { async use(): Promise<void> { console.log("controller") } } @Controller({ path: "/test" }) @Tags("Test") @Use(ControllerMiddleware) export class TestController { @Get("/") @UseBefore(BeforeMiddleware) async get(): Promise<void> { console.log("endpoint") } }
I have this in the console:
controller before endpoint
The text was updated successfully, but these errors were encountered:
fix(common): before middleware should execute before use middleware
4815df8
Closes: tsedio#1594
2f5dc58
3986dfb
Closes: #1594
🎉 This issue has been resolved in version 6.75.8 🎉
The release is available on:
v6.75.8
Your semantic-release bot 📦🚀
Sorry, something went wrong.
Romakita
Successfully merging a pull request may close this issue.
Information
UseBefore Middleware on an endpoint is always called after Use middleware on the controller.
From the doc https://tsed.io/docs/middlewares.html#call-sequences, the sequence is:
MdlwCtrlBefore,
MdlwCtrlBeforeEach
MdlwBefore, (EndPoint)
MdlwCtrl,
MyCtrl.endpointA
But from my tests, MdlwBefore is called after MdlwCtrl
Example
I have this in the console:
controller
before
endpoint
Acceptance criteria
The text was updated successfully, but these errors were encountered: