-
-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
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
contextsSymbol prevents proper encapsulation of middleware #813
Comments
Hey! I guess reverting back to string keys should make it. |
...well, I actually fixed it already. v6.3.1 is out. |
Lol, we encountered this bug when we decided to modularize our header validation literally days ago. Talk about good timing. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I wrote an npm package to reuse my express validation code.
This package allows me to inject error handling as a middleware into my express app using the
.use()
method.The validation for arbitrary routes can be called as shown in the following code snippet of my router:
@maxarndt/some-package
looks like the following:Problem
While this works like a charm in my component tests in the package project it fails when I use this npm package in another application.
The
validationResult(req)
function does not extract any errors because thecontextsSymbol
does not match. (Link to the line invalidation-result.ts
)My problem seems to be, that I require
express-validator@6.3.0
in my private package and additionally in the application which uses my own npm package.I can avoid this error by exporting your
check
function and using this one. But I didn't want to wrap your whole module.Is this an intended behavior? And if that's the case why is it necessary to use such a symbol?
I would have expected the validation to work properly.
The text was updated successfully, but these errors were encountered: