PerlDancer / Dancer2

Perl Dancer Next Generation (rewrite of Perl Dancer)
http://perldancer.org/
Other
537 stars 272 forks source link

send_as JSON doesn't seem to be calling serializer hooks #1709

Open GeekRuthie opened 2 months ago

GeekRuthie commented 2 months ago

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.)