1use strict;
2use Plack::Test;
3use HTTP::Request::Common;
4use Test::More;
5use Test::Requires qw(HTTP::Cookies);
6
7my $app = sub {
8    return [ 200, [ 'Content-Type' => 'text/html', 'Set-Cookie' => "ID=123; path=/" ], [ "Hi" ] ];
9};
10
11test_psgi app => $app, client => sub {
12    my $cb = shift;
13
14    my $res = $cb->(GET "http://localhost/");
15
16    my $cookie_jar = HTTP::Cookies->new;
17    $cookie_jar->extract_cookies($res);
18
19    my @cookies;
20    $cookie_jar->scan( sub { @cookies = @_ });
21
22    ok @cookies;
23    is $cookies[1], 'ID';
24};
25
26done_testing;
27