Fixes the use of Plack::Respose->new
Tatsuhiko Miyagawa [Sun, 31 Jan 2010 07:13:07 +0000 (23:13 -0800)]
lib/Plack/Session/State/Cookie.pm
t/010_middleware.t

index b8571a3..4e60428 100644 (file)
@@ -55,7 +55,7 @@ sub _set_cookie {
     my($self, $id, $res, %options) = @_;
 
     # TODO: Do not use Plack::Response
-    my $response = Plack::Response->new($res);
+    my $response = Plack::Response->new(@$res);
     $response->cookies->{ $self->session_key } = +{
         value => $id,
         %options,
index 1103bf7..9fe0842 100644 (file)
@@ -11,7 +11,7 @@ my $app = sub {
     my $body = "Counter=$counter";
     $env->{'psgix.session'}->{counter} = $counter + 1;
 
-    return [ 200, [], [ $body ] ];
+    return [ 200, [ 'Content-Type', 'text/html' ], [ $body ] ];
 };
 
 $app = Plack::Middleware::Session->wrap($app);
@@ -22,6 +22,7 @@ test_psgi $app, sub {
     my $jar = HTTP::Cookies->new;
 
     my $res = $cb->(GET "http://localhost/");
+    is $res->content_type, 'text/html';
     is $res->content, "Counter=0";
     $jar->extract_cookies($res);