$env->{'psgix.session'}->{counter} = 1;
- $env->{'psgix.session.options'}{path} = '/foo';
+ my $path = $env->{PATH_INFO} =~ /with_path/ ? "/foo" : undef;
+ $env->{'psgix.session.options'}{path} = $path;
$env->{'psgix.session.options'}{domain} = '.example.com';
$env->{'psgix.session.options'}{httponly} = 1;
my $cb = shift;
my $res = $cb->(GET "http://localhost/");
+ like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; HttpOnly/;
+
+ $res = $cb->(GET "http://localhost/with_path");
like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; path=\/foo; HttpOnly/;
};