Dancer2
Dancer2 copied to clipboard
send_as JSON doesn't seem to be calling serializer hooks
I'm working on a new plugin to intercept send_as serialized requests, and (despite the fact that the call to execute_hook is in the Role's "around"), I'm not seeing the before_serializer or after_serializer hooks firing. The code in send_as seems to be calling up Dancer2::Core::Serializer::JSON::serialize here, but hooks just aren't firing! I've tried adding a before_serializer hook in the application, as well as this, in the plugin I'm working with:
$plugin->app->add_hook( Dancer2::Core::Hook->new( name => 'engine.serializer.before', code => sub { warn 'Oh, yeah!' }, ));
I think I'll put in some tracers in D2 code to make sure what apparently should be happening here, actually is. (It's possible I'm Doing It Wrong, too, of course.)