-
Notifications
You must be signed in to change notification settings - Fork 209
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
Response is serialized before before_serializer
hook is called
#1232
Comments
If we compare Lines 91 to 102 in dc9df8b
But for Lines 223 to 231 in dc9df8b
This, for examples, prevents us to filter out Lines 215 to 222 in dc9df8b
|
If we look how application dies we will notice that Lines 106 to 111 in dc9df8b
and serialized here: Lines 225 to 229 in dc9df8b
I suppose it would be better if we change code like this: --- a/lib/Dancer/Error.pm
+++ b/lib/Dancer/Error.pm
@@ -224,7 +224,7 @@ sub _render_serialized {
if (setting('show_errors')) {
Dancer::Response->new(
status => $self->code,
- content => Dancer::Serializer->engine->serialize($message),
+ content => $message,
headers => ['Content-Type' => Dancer::Serializer->engine->content_type]
);
}
diff --git a/lib/Dancer/Handler.pm b/lib/Dancer/Handler.pm
index 0ee9961b..77bcfb83 100644
--- a/lib/Dancer/Handler.pm
+++ b/lib/Dancer/Handler.pm
@@ -106,9 +106,10 @@ sub render_request {
Dancer::Error->new(
code => 500,
title => "Runtime Error",
- message => "$exception",
+ message => $exception,
exception => $exception,
)->render();
+ Dancer::Serializer->process_response(Dancer::SharedData->response);
};
return $action;
} With this change we can control how error message is serialized and can filter out |
When we at our action do
send_error { some => 'error' }
the$response->content
is serialized beforebefore_serializer
hook is called:Dancer/lib/Dancer/Renderer.pm
Line 199 in dc9df8b
this forehead serialization occurs here:
which in turn called from here
The text was updated successfully, but these errors were encountered: