7 use lib "$FindBin::Bin/../lib";
9 use Test::More tests => 15;
10 use Catalyst::Test 'TestApp';
11 use HTTP::Headers::Util 'split_header_words';
14 catalyst => [qw|catalyst cool path /bah|],
15 cool => [qw|cool catalyst path /|]
19 ok( my $response = request('http://localhost/engine/response/cookies/one'),
21 ok( $response->is_success, 'Response Successful 2xx' );
22 is( $response->content_type, 'text/plain', 'Response Content-Type' );
23 is( $response->header('X-Catalyst-Action'),
24 'engine/response/cookies/one', 'Test Action' );
28 for my $string ( $response->header('Set-Cookie') ) {
29 my $cookie = [ split_header_words $string];
30 $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
33 is_deeply( $cookies, $expected, 'Response Cookies' );
37 ok( my $response = request('http://localhost/engine/response/cookies/two'),
39 ok( $response->is_redirect, 'Response Redirection 3xx' );
40 is( $response->code, 302, 'Response Code' );
41 is( $response->header('X-Catalyst-Action'),
42 'engine/response/cookies/two', 'Test Action' );
46 for my $string ( $response->header('Set-Cookie') ) {
47 my $cookie = [ split_header_words $string];
48 $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
51 is_deeply( $cookies, $expected, 'Response Cookies' );
55 ok( my $response = request('http://localhost/engine/response/cookies/three'),
57 ok( $response->is_success, 'Response Successful 2xx' );
58 is( $response->content_type, 'text/plain', 'Response Content-Type' );
59 is( $response->header('X-Catalyst-Action'),
60 'engine/response/cookies/three', 'Test Action' );
64 for my $string ( $response->header('Set-Cookie') ) {
65 my $cookie = [ split_header_words $string];
66 $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
69 is_deeply( $cookies, {
70 hash => [ qw(hash a&b&c path /) ],
71 this_is_the_real_name => [ qw(this_is_the_real_name foo&bar path /) ], # not "object"
72 }, 'Response Cookies' );