You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above repository has a middleware and the following endpoints:
the first is /all. The middleware should run for this endpoint.
The second is /:id. The middleware should not run for this endpoint.
You can reproduce the issue by using the tests in the repository.
Run the tests from the above repository.
Notice how the /all endpoint test fails and the /:id endpoint test succeeds when only the /:id endpoint is excluded.
Expected behavior
Only the excluded endpoints should be excluded from the middleware. The middleware should run for the /all endpoint and shouldn't run for the /:id endpoint.
Is there an existing issue for this?
Current behavior
This issue happens when there are 2 endpoints:
/all
/:id
If the
/:id
endpoint is excluded from the middleware then the middleware is not called for both of the 2 endpoints.Minimum reproduction code
https://github.com/AbanobNageh/nestjs-middleware-exclude-issue
Steps to reproduce
The above repository has a middleware and the following endpoints:
/all
. The middleware should run for this endpoint./:id
. The middleware should not run for this endpoint.You can reproduce the issue by using the tests in the repository.
/all
endpoint test fails and the/:id
endpoint test succeeds when only the/:id
endpoint is excluded.Expected behavior
Only the excluded endpoints should be excluded from the middleware. The middleware should run for the
/all
endpoint and shouldn't run for the/:id
endpoint.Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
10.3.8
Packages versions
Node.js version
20.10.0
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: