X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTest%2FWWW%2FMechanize%2FCatalyst.pm;h=8910c44c83cf2c4ff60997b58af6c01b93937524;hb=affa35d5063fbeb1ca9ccc5bff2372b583c8575f;hp=866a09f5aecfd42f3df4c666579220dc02777779;hpb=d6fc3a22e3ac5404cbf4bebfae7dab3e8073ad01;p=catagits%2FTest-WWW-Mechanize-Catalyst.git diff --git a/lib/Test/WWW/Mechanize/Catalyst.pm b/lib/Test/WWW/Mechanize/Catalyst.pm index 866a09f..8910c44 100644 --- a/lib/Test/WWW/Mechanize/Catalyst.pm +++ b/lib/Test/WWW/Mechanize/Catalyst.pm @@ -99,6 +99,7 @@ sub _make_request { # check if that was a redirect if ( $response->header('Location') + && $response->is_redirect && $self->redirect_ok( $request, $response ) ) { @@ -142,8 +143,6 @@ sub _do_catalyst_request { return Catalyst::Test::remote_request($request) if $ENV{CATALYST_SERVER}; - - # If there's no Host header, set one. unless ($request->header('Host')) { my $host = $self->has_host @@ -452,6 +451,21 @@ Returns true value if the specified link was found and followed successfully. The HTTP::Response object returned by follow_link() is not available. +=head1 CAVEATS + +=head2 External Redirects and allow_external + +If you use non-fully qualified urls in your test scripts (i.e. anything without +a host, such as C<< ->get_ok( "/foo") >> ) and your app redirects to an +external URL, expect to be bitten once you come back to your application's urls +(it will try to request them on the remote server.) This is due to a limitation +in WWW::Mechanize. + +One workaround for this is that if you are expecting to redirect to an external +site, clone the TWMC obeject and use the cloned object for the external +redirect. + + =head1 SEE ALSO Related modules which may be of interest: L,