X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FRoot.pm;h=ed51778ed746c3279eeefe75c87b1ab3ef4fa483;hb=d67d5f8734a887d0dbd2eeaa5623cf1116a4b626;hp=e34eacdebfe615b454f5147299076bfbf97aa726;hpb=bcc7361a26b0c7a55eb6b4d49d4622367b12f809;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm index e34eacd..ed51778 100644 --- a/t/lib/TestApp/Controller/Root.pm +++ b/t/lib/TestApp/Controller/Root.pm @@ -75,6 +75,35 @@ EndOfBody $c->response->body($body); } +sub body_semipredicate : Local { + my ($self, $c) = @_; + $c->res->body; # Old code tests length($c->res->body), which causes the value to be built (undef), which causes the predicate + $c->res->status( $c->res->has_body ? 500 : 200 ); # to return the wrong thing, resulting in a 500. + $c->res->body('Body'); +} + + +sub test_redirect :Global { + my ($self, $c) = @_; + # Don't set content_type + # Don't set body + $c->res->redirect('/go_here'); +} + +sub test_redirect_with_contenttype :Global { + my ($self, $c) = @_; + # set content_type but don't set body + $c->res->content_type('image/jpeg'); + $c->res->redirect('/go_here'); +} + +sub test_redirect_with_content :Global { + my ($self, $c) = @_; + $c->res->content_type('text/plain'); + $c->res->body('Please kind sir, I beg you to go to /go_here.'); + $c->res->redirect('/go_here'); +} + sub end : Private { my ($self,$c) = @_; }