Checking in changes prior to tagging of version 0.09_01. Changelog diff is:
[catagits/Web-Session.git] / t / 015_cookie_options_mw.t
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