From 36f1f4c9f9fc0a56522b7396c621b1d84894901a Mon Sep 17 00:00:00 2001 From: Russell Jenkins Date: Sun, 29 Sep 2013 16:46:53 +1000 Subject: [PATCH] Do not halt the response on redirect. Use the with_return handler to return immediatly to the dispatcher after the redirect details have been added to the response. Resolves #432. --- lib/Dancer2/Core/Context.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Dancer2/Core/Context.pm b/lib/Dancer2/Core/Context.pm index 69663b0d2..1de41427f 100644 --- a/lib/Dancer2/Core/Context.pm +++ b/lib/Dancer2/Core/Context.pm @@ -178,8 +178,10 @@ sub redirect { $destination = $self->request->uri_for( $destination, {}, 1 ); } - $self->response->halt; $self->response->redirect( $destination, $status ); + # Short circuit any remaining before hook / route code + # ('pass' and after hooks are still processed) + $self->with_return->($self->response) if $self->has_with_return; }