2 use Plack::Middleware::Session;
4 use HTTP::Request::Common;
9 my $counter = $env->{'psgix.session'}->{counter} || 0;
11 my $body = "Counter=$counter";
12 $env->{'psgix.session'}->{counter} = $counter + 1;
14 return [ 200, [ 'Content-Type', 'text/html' ], [ $body ] ];
17 $app = Plack::Middleware::Session->wrap($app);
22 my $jar = HTTP::Cookies->new;
24 my $res = $cb->(GET "http://localhost/");
25 is $res->content_type, 'text/html';
26 is $res->content, "Counter=0";
27 $jar->extract_cookies($res);
29 my $req = GET "http://localhost/";
30 $jar->add_cookie_header($req);
32 is $res->content, "Counter=1";