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
Thanks a lot for Nest.js, I'm really loving the work that you guys are putting out there !
Bug Report
Current behaviour
If we use two different guards using the same class name but different files, only the first guard met will be recognise and used (cf. repo link below).
In the repo, you can see CommentController uses src/comment/is-owner.guard.ts which will always fails as it returns false.
But because, in app.module.ts we declare our controller in the order controllers: [ AppController, PostController, CommentController ], only the guard src/post/is-owner.guard.ts is actually used.
You can see that all the request will be successful on http://localhost:3000/post and http://localhost:3000/comment.
Expected behavior
Nest.js should differentiate both guards even if they use the same name.
Possible Solution
At least I think it should throw an error if we use two different guard with the same class name.
Environment
Nest version: 6.10.14
The text was updated successfully, but these errors were encountered:
Hello there 馃憢
Thanks a lot for Nest.js, I'm really loving the work that you guys are putting out there !
Bug Report
Current behaviour
If we use two different guards using the same class name but different files, only the first guard met will be recognise and used (cf. repo link below).
Input Code
Repo: https://github.com/stvnyung/nest-guard-issue
Specific commit implementing the issue: https://github.com/stvnyung/nest-guard-issue/commit/7040292e033574b80ee79aeef3f6b5c21d1611d6
In the repo, you can see
CommentController
usessrc/comment/is-owner.guard.ts
which will always fails as it returnsfalse
.But because, in
app.module.ts
we declare our controller in the ordercontrollers: [ AppController, PostController, CommentController ]
, only the guardsrc/post/is-owner.guard.ts
is actually used.You can see that all the request will be successful on
http://localhost:3000/post
andhttp://localhost:3000/comment
.Expected behavior
Nest.js should differentiate both guards even if they use the same name.
Possible Solution
At least I think it should throw an error if we use two different guard with the same class name.
Environment
The text was updated successfully, but these errors were encountered: