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
Set route validation bind context #3227
Conversation
How can I fix |
By covering all the possibilities in your tests. |
so that line looks like this: const bind = request.route.settings.bind || request.route.realm || null; in order to get full coverage, you need tests where |
@@ -139,7 +139,8 @@ internals.input = function (source, request, next) { | |||
|
|||
request._protect.run(postValidate, (exit) => { | |||
|
|||
return schema(request[source], localOptions, exit); | |||
const bind = request.route.settings.bind || request.route.realm || null; | |||
return schema.call(bind, request[source], localOptions, exit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want call
on hot code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call
and apply
are not slower than bound functions last time I checked, how would you do it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the whole framework so you always pass a context
object rather than relying on this
😄
But seriously, yeah there really isn't a way to do that other than call
here.
remove unreachable condition when realm is falsy
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
fixes #3226