X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_engine_response_cookies.t;h=cffca3ac36b5ae1340af63ca02768d081db6325d;hb=f9bcc1280f6685f1d937688ed9c035bc9994a01e;hp=769d9a2099f06f31eb25e0e751890d9e6e852f43;hpb=38b304cdbe60a26fc3ae4bd3c02d2a9a865f16e9;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_engine_response_cookies.t b/t/live_engine_response_cookies.t index 769d9a2..cffca3a 100644 --- a/t/live_engine_response_cookies.t +++ b/t/live_engine_response_cookies.t @@ -6,13 +6,13 @@ use warnings; use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 10; +use Test::More tests => 15; use Catalyst::Test 'TestApp'; use HTTP::Headers::Util 'split_header_words'; my $expected = { - Catalyst => [qw|Catalyst Cool path /|], - Cool => [qw|Cool Catalyst path /|] + catalyst => [qw|catalyst cool path /bah|], + cool => [qw|cool catalyst path /|] }; { @@ -37,7 +37,7 @@ my $expected = { ok( my $response = request('http://localhost/engine/response/cookies/two'), 'Request' ); ok( $response->is_redirect, 'Response Redirection 3xx' ); - is( $response->code, 301, 'Response Code' ); + is( $response->code, 302, 'Response Code' ); is( $response->header('X-Catalyst-Action'), 'engine/response/cookies/two', 'Test Action' ); @@ -50,3 +50,24 @@ my $expected = { is_deeply( $cookies, $expected, 'Response Cookies' ); } + +{ + ok( my $response = request('http://localhost/engine/response/cookies/three'), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), + 'engine/response/cookies/three', 'Test Action' ); + + my $cookies = {}; + + for my $string ( $response->header('Set-Cookie') ) { + my $cookie = [ split_header_words $string]; + $cookies->{ $cookie->[0]->[0] } = $cookie->[0]; + } + + is_deeply( $cookies, { + hash => [ qw(hash a&b&c path /) ], + this_is_the_real_name => [ qw(this_is_the_real_name foo&bar path /) ], # not "object" + }, 'Response Cookies' ); +}