From: Tatsuhiko Miyagawa Date: Sun, 31 Jan 2010 07:13:07 +0000 (-0800) Subject: Fixes the use of Plack::Respose->new X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e447333d0425330038570ab0462406fc2e94286;hp=91b87895a2b8a5eaf873fe79c4a86189ae25d6e4;p=catagits%2FWeb-Session.git Fixes the use of Plack::Respose->new --- diff --git a/lib/Plack/Session/State/Cookie.pm b/lib/Plack/Session/State/Cookie.pm index b8571a3..4e60428 100644 --- a/lib/Plack/Session/State/Cookie.pm +++ b/lib/Plack/Session/State/Cookie.pm @@ -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, diff --git a/t/010_middleware.t b/t/010_middleware.t index 1103bf7..9fe0842 100644 --- a/t/010_middleware.t +++ b/t/010_middleware.t @@ -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);