How can I remove a hook from the app on the fly? #3520
Answered
by
Mairu
imcodingideas
asked this question in
Q&A
|
I have a hook that shows errors generated in the console along with their stack trace, but I want to disable it in some tests. I don’t want to disable it in all tests because it can be useful when debugging, but if I’m testing an endpoint that should fail and I know it will generate an error, I’d like to disable that hook in my app to keep the console clean. What do you suggest I do? |
Answered by
Mairu
Jul 31, 2024
Replies: 1 comment
|
You could make it conditional either by using a request parameter like header or query parameter or if it is only for tests, by using a variable. (https://hooks-common.feathersjs.com/hooks#iff could potentially be useful) |
0 replies
Answer selected by
imcodingideas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could make it conditional either by using a request parameter like header or query parameter or if it is only for tests, by using a variable.
(https://hooks-common.feathersjs.com/hooks#iff could potentially be useful)