no :PathPart -> :PathPart('subname')
[catagits/Catalyst-Runtime.git] / t / live_engine_response_redirect.t
CommitLineData
dd4e6fd2 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
a2e038a1 7use lib "$FindBin::Bin/lib";
dd4e6fd2 8
c20bd9d9 9use Test::More tests => 20;
dd4e6fd2 10use Catalyst::Test 'TestApp';
11
12{
13 ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' );
14 ok( $response->is_redirect, 'Response Redirection 3xx' );
f1bbebac 15 is( $response->code, 302, 'Response Code' );
dd4e6fd2 16 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' );
17 is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' );
18}
19
20{
21 ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' );
22 ok( $response->is_redirect, 'Response Redirection 3xx' );
f1bbebac 23 is( $response->code, 302, 'Response Code' );
dd4e6fd2 24 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' );
25 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
26}
27
28{
29 ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' );
30 ok( $response->is_redirect, 'Response Redirection 3xx' );
31 is( $response->code, 301, 'Response Code' );
32 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' );
33 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
34}
35
36{
37 ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' );
38 ok( $response->is_redirect, 'Response Redirection 3xx' );
39 is( $response->code, 307, 'Response Code' );
40 is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' );
41 is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
42}