3 use Plack::Middleware::Session;
5 use HTTP::Request::Common;
11 $env->{'psgix.session'}->{counter} = 1;
13 my $path = $env->{PATH_INFO} =~ /with_path/ ? "/foo" : undef;
14 $env->{'psgix.session.options'}{path} = $path;
15 $env->{'psgix.session.options'}{domain} = '.example.com';
16 $env->{'psgix.session.options'}{httponly} = 1;
18 return [ 200, [], [ "Hi" ] ];
21 $app = Plack::Middleware::Session->wrap($app);
26 my $res = $cb->(GET "http://localhost/");
27 like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; HttpOnly/;
29 $res = $cb->(GET "http://localhost/with_path");
30 like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; path=\/foo; HttpOnly/;