From: Kieren Diment Date: Mon, 12 Mar 2007 11:07:02 +0000 (+0000) Subject: improved docs showing how to handle redirects X-Git-Tag: 5.7099_04~233 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=f13fc03fe888214323259fd26fe0cb81b7832beb improved docs showing how to handle redirects --- diff --git a/lib/Catalyst/Test.pm b/lib/Catalyst/Test.pm index ee37228..b3c25cc 100644 --- a/lib/Catalyst/Test.pm +++ b/lib/Catalyst/Test.pm @@ -55,6 +55,17 @@ Returns the content. my $content = get('foo/bar?test=1'); +Note that this method doesn't follow redirects, so to test for a +correctly redirecting page you'll need to use a combination of this +method and the L method below: + + my $res = request('/'); # redirects to /y + warn $res->header('location'); + use URI; + my $uri = URI->new($res->header('location')); + is ( $uri->path , '/y'); + my $content = get($uri->path); + =head2 request Returns a C object.