Commit | Line | Data |
442b79a8 |
1 | use strict; |
2 | use Plack::Test; |
3 | use Plack::Middleware::Session; |
4 | use Test::More; |
5 | use HTTP::Request::Common; |
6 | use HTTP::Cookies; |
7 | |
8 | my $app = sub { |
9 | my $env = shift; |
10 | |
11 | $env->{'psgix.session'}->{counter} = 1; |
12 | |
13 | $env->{'psgix.session.options'}{path} = '/foo'; |
14 | $env->{'psgix.session.options'}{domain} = '.example.com'; |
15 | $env->{'psgix.session.options'}{httponly} = 1; |
16 | |
17 | return [ 200, [], [ "Hi" ] ]; |
18 | }; |
19 | |
20 | $app = Plack::Middleware::Session->wrap($app); |
21 | |
22 | test_psgi $app, sub { |
23 | my $cb = shift; |
24 | |
25 | my $res = $cb->(GET "http://localhost/"); |
26 | like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; path=\/foo; HttpOnly/; |
27 | }; |
28 | |
29 | done_testing; |
30 | |