Skip to content

Commit

Permalink
Use with_return handler to return control back to the dispatcher afte…
Browse files Browse the repository at this point in the history
…r forward.

This is the implementation of "... after a forward is executed, any remaining
code (route and hooks) from the current dispatch will never be run." from PerlDancer#432.
  • Loading branch information
veryrusty committed Nov 4, 2013
1 parent 36f1f4c commit b35b68d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Dancer2/Core/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,12 @@ sub forward {
$new_request,
$context,
);
# halt the response, so no further processing is done on this request.
# (any after hooks will have already been run)
$new_response->halt;
$context->response($new_response);
return $new_response;
$context->with_return->($new_response) if $context->has_with_return;
return $new_response; # Should never be called..
}

sub _merge_params {
Expand Down

0 comments on commit b35b68d

Please sign in to comment.