Created
August 16, 2010 10:14
-
-
Save memowe/526737 to your computer and use it in GitHub Desktop.
Without this patch, redirecting without render leads to a long delay in user agents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojolicious/Controller.pm b/lib/Mojolicious/Controller.pm | |
index 55d556d..afb944f 100644 | |
--- a/lib/Mojolicious/Controller.pm | |
+++ b/lib/Mojolicious/Controller.pm | |
@@ -88,6 +88,9 @@ sub redirect_to { | |
# Location header | |
$self->res->headers->location($self->url_for(@_)->to_abs); | |
+ # Redirect body | |
+ $self->res->body('Redirecting!'); | |
+ | |
return $self; | |
} | |
diff --git a/t/mojolicious/lite_app.t b/t/mojolicious/lite_app.t | |
index 3ff2f6f..55daa68 100644 | |
--- a/t/mojolicious/lite_app.t | |
+++ b/t/mojolicious/lite_app.t | |
@@ -1051,7 +1051,7 @@ $t->get_ok('/redirect_named')->status_is(302) | |
$t->get_ok('/redirect_no_render')->status_is(302) | |
->header_is(Server => 'Mojolicious (Perl)') | |
->header_is('X-Powered-By' => 'Mojolicious (Perl)') | |
- ->header_like(Location => qr/\/template.txt$/)->content_is(''); | |
+ ->header_like(Location => qr/\/template.txt$/)->content_is('Redirecting!'); | |
# GET /redirect_named (with redirecting enabled in client) | |
$t->max_redirects(3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment