Commit | Line | Data |
b2504d01 |
1 | use strict; |
2 | use Test::More; |
3 | use Test::Requires qw(Plack::Server::AnyEvent); |
4 | use Plack::Test; |
5 | use Plack::Middleware::Session; |
6 | use HTTP::Request::Common; |
7 | |
8 | $Plack::Test::Impl = 'Server'; |
9 | $ENV{PLACK_SERVER} = 'AnyEvent'; |
10 | |
11 | my $app = sub { |
12 | return sub { |
13 | my $respond = shift; |
14 | my $w = $respond->([ 200, [ 'Content-Type' => 'text/html' ] ]); |
15 | $w->write("Hello"); |
16 | $w->close; |
17 | }; |
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 "/"); |
26 | is $res->content, "Hello"; |
27 | like $res->header('Set-Cookie'), qr/plack_session/; |
28 | }; |
29 | |
30 | done_testing; |