You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Dancer::Plugin::Interchange6::Routes there is a fallback route intended to fire on various vanilla requests. At the end of the route, assuming it's found nothing else, it does this:
status 'not_found';
forward '404';
I was trying to make an Interchange6 application work with the auto_page directive, so I really want the fallback to not generate a 404 at this point, but instead hand off to the auto_page code. So I prepended this:
return if setting 'auto_page';
However, this just generates an empty page. Upon further digging, I figured out why:
Dancer::Renderer:
sub render_action {
my $class = shift;
my $resp = $class->get_action_response();
return (defined $resp)
? response_with_headers()
: undef;
}
In my scenario, what is being returned here is not Perly false, but --
This may well be a naive question, but here goes:
In Dancer::Plugin::Interchange6::Routes there is a fallback route intended to fire on various vanilla requests. At the end of the route, assuming it's found nothing else, it does this:
status 'not_found';
forward '404';
I was trying to make an Interchange6 application work with the auto_page directive, so I really want the fallback to not generate a 404 at this point, but instead hand off to the auto_page code. So I prepended this:
return if setting 'auto_page';
However, this just generates an empty page. Upon further digging, I figured out why:
Dancer::Renderer:
sub render_action {
my $class = shift;
my $resp = $class->get_action_response();
return (defined $resp)
? response_with_headers()
: undef;
}
In my scenario, what is being returned here is not Perly false, but --
bless( {'content' => '','encoded' => 0,'forward' => '','halted' => 0,'headers' => bless( {'content-type' => 'text/html'}, 'HTTP::Headers' ),'pass' => 0,'status' => 200}, 'Dancer::Response' )
So I have naively changed the render_action code locally to:
...
return (defined $resp and (length $resp->{content} or $resp->{status} != 200))
which seems to work. Is there a reason why render_action "succeeds" in this case (where the returned content is empty)?
The text was updated successfully, but these errors were encountered: