Hi,
First of all, thanks for Dredd, it's an awesome tool and I enjoy using it more and more.
Here's a suggestion. I'd like to be able to use wildcards in my hooks, so that every transaction within a group or a URI is handled by the same hook. For instance:
hooks.before("Admin > Member actions > *", function(transaction) {
transaction.request['headers']['Authorization'] = 'Basic ADMINBASICAUTH'
});
or
hooks.before("Admin > *", function(transaction) {
transaction.request['headers']['Authorization'] = 'Basic ADMINBASICAUTH'
});
Is that already possible in a way I missed (aside from copy/pasting for each transaction)?
Is that a feature you plan to implement anytime soon?
Thanks!
Eric
Hi @efavre,
this make perfect sense. Thank you very much for your suggestion! Much appreciated. 馃崚
This is implemented in the php hooks although I am waiting to merge the PR. I would like to add this to all the other ones so the functionality is kept consistent across all of the hooks.
As I mentioned in #622, it could be neat to also have this syntax supported in the --only command line option and in the config file as well.
Hi,
this feature (wildcards in transaction names) is implemented only for the php hooks? or is already available for the other languages like node.js(JavaScript)?
Thanks!
Jo茫o
It's not in the JavaScript hooks yet. But you can easily code your own:
hooks.beforeEach(function(transaction, done) {
if (transaction.name.match(/^Admin > Member actions > /)) {
// do what you want
}
done();
}
Most helpful comment
As I mentioned in #622, it could be neat to also have this syntax supported in the
--onlycommand line option and in the config file as well.