Note for other redirect test
[catagits/Catalyst-Runtime.git] / t / aggregate / live_engine_response_redirect.t
CommitLineData
dd4e6fd2 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
42da66a9 7use lib "$FindBin::Bin/../lib";
dd4e6fd2 8
fa0fae2a 9use Test::More tests => 26;
dd4e6fd2 10use Catalyst::Test 'TestApp';
11
47112c3c 12# XXX: these fail on remote servers due to LWP max_redirect 0 bug:
13# http://rt.cpan.org/Ticket/Display.html?id=40260
dd4e6fd2 14{
15 ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' );
16 ok( $response->is_redirect, 'Response Redirection 3xx' );
f1bbebac 17 is( $response->code, 302, 'Response Code' );
dd4e6fd2 18 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' );
19 is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' );
fa0fae2a 20 ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' );
21 ok( $response->content, '302 Redirect contains a response body' );
dd4e6fd2 22}
23
24{
25 ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' );
26 ok( $response->is_redirect, 'Response Redirection 3xx' );
f1bbebac 27 is( $response->code, 302, 'Response Code' );
dd4e6fd2 28 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' );
29 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
30}
31
32{
33 ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' );
34 ok( $response->is_redirect, 'Response Redirection 3xx' );
35 is( $response->code, 301, 'Response Code' );
36 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' );
37 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
fa0fae2a 38 ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' );
39 ok( $response->content, '301 Redirect contains a response body' );
dd4e6fd2 40}
41
42{
43 ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' );
44 ok( $response->is_redirect, 'Response Redirection 3xx' );
45 is( $response->code, 307, 'Response Code' );
46 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' );
47 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
fa0fae2a 48 ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' );
49 ok( $response->content, '307 Redirect contains a response body' );
dd4e6fd2 50}