Checking in changes prior to tagging of version 0.09_02. Changelog diff is:
[catagits/Web-Session.git] / t / 015_cookie_options_mw.t
CommitLineData
442b79a8 1use strict;
2use Plack::Test;
3use Plack::Middleware::Session;
4use Test::More;
5use HTTP::Request::Common;
6use HTTP::Cookies;
7
8my $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
22test_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
29done_testing;
30